<?php require_once('db_con.php'); $ind_inv_result = mysql_query("SELECT DISTINCT `desc`,`cat_no` FROM `inventory` WHERE `po_num` = '6000'"); while ($ind_inv_row = mysql_fetch_array($ind_inv_result)){ if($main_item){ echo 'main set'; $main_item++; } if(!$main_item){ echo 'main not set'; $main_item=0; }; echo $main_item; }?> PHP: That is my code. There are 4 results from the query, so it should run the while loop 4 times. The first time it goes through, it should output: main not set0 then the next 3 times it should output main set1-3 correct? It is outputting mainnotset0 4 times and I don't understand why... any help is greatly appreciated!
sorry got that the other way around if(isset($main_item)) as if($main_item) is also FALSE for 0 value.