title: integer from mysql always returns 0
body: <p>I have some code that pulls data from a mysql db everything is pulling great, dates, variables, etc. The problem I have is the only integer is returning 0 every time. </p>
  
  <pre><code>while($row = mysqli_fetch_array($result)) {
  $fufilled = "1";
  $flag = $row['flag'];
  $shopnumb = $row['Shopnumb'];
  $shoptype = $row['Shop_type'];
  ...
  </code></pre>
  
  <p><code>$shoptype</code> and <code>$shopnumb</code> both return correct content however $flag returns 0 every time even though the database has 1,1,1,1,0 for the 5 rows</p>
  
  <pre><code>CREATE TABLE `Shop_data` (
   `Shopnumb` int(15) NOT NULL AUTO_INCREMENT COMMENT 'shop id number',
   `flag` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1=unread 0=read',
   `CID` int(15) NOT NULL COMMENT 'Client this shop belongs to',
   `SID` varchar(50) DEFAULT NULL COMMENT 'identifys which survey to use',
   `comp_date` date DEFAULT NULL COMMENT 'Completion Date',
   `sched_date` date DEFAULT NULL COMMENT 'Scheduled shop date',
   `shop_comp` smallint(1) NOT NULL DEFAULT '0' COMMENT 'shopper submitted report',
   `edit_comp` smallint(1) NOT NULL DEFAULT '0' COMMENT 'Report has been edited',
   `return_shop` smallint(1) NOT NULL DEFAULT '0' COMMENT 'return report to shopper for editing',
   `report_comp` smallint(1) NOT NULL DEFAULT '0' COMMENT 'report ready for client',
   `Shop_type` varchar(50) DEFAULT NULL,
   `Shoploc` varchar(100) DEFAULT NULL,
   `shop_cost` decimal(10,2) DEFAULT NULL COMMENT 'Normal or adjusted cost of shop',
   `shop_reimb` decimal(10,2) DEFAULT NULL COMMENT 'Shopper reimburstment cost',
   `shop_pay` decimal(10,2) DEFAULT NULL COMMENT 'Total cost',
   `shopper_assign` varchar(200) DEFAULT NULL COMMENT 'Identifys which shopper assigned',
   PRIMARY KEY (`Shopnumb`),
   UNIQUE KEY `Shopnumb` (`Shopnumb`)
  ) ENGINE=MyISAM AUTO_INCREMENT=2252 DEFAULT CHARSET=latin1
  </code></pre>
  
  <p>my query</p>
  
  <pre><code>SELECT * FROM Shop_data WHERE CID='".$_SESSION['CID']."' AND report_comp='1' AND DATEDIFF(CURDATE(), comp_date) &lt;".$lengthoftime." ORDER BY comp_date DESC;
  </code></pre>
  
  <p>like I said everything returns great except flag</p>
  
  <p>if statement</p>
  
  <pre><code>        if ($flag = '0') {
              echo "&lt;td align=\"center\"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/td&gt;";
          } else {
              echo "&lt;td align=\"center\"&gt;&amp;nbsp;&amp;nbsp;&lt;img align=\"middle\" src=\"/images/flag.png\"&gt;&amp;nbsp;&amp;nbsp;&lt;/td&gt;";
          }
  </code></pre>
  
  <p>fixed
                  if ($flag == '0') {</p>