travelkind Posted October 30, 2009 Share Posted October 30, 2009 I was wondering how I could make an entire line of a query result not show up if the result is equal to "0". I have copied the code below and made the area bold that I believe needs to be changed. Thanks for your help! // Make a MySQL Connection // Construct our join query $query = "SELECT sunocoimport.duns_num, custmast.gl_num, custmast.division_num, custmast.customer_num, sunocoimport.summary_date, sunocoimport.cc_fees, custmast.fee_percent, custmast.clear FROM sunocoimport, custmast WHERE sunocoimport.duns_num = custmast.duns_num"; $result = mysql_query($query)or die(mysql_error()); // Print out the contents of each row into a table while($row = mysql_fetch_array($result)){ echo $row['division_num'].",".$row['customer_num'].",".$row['summary_date'].",".round($row['cc_fees'] * $row['fee_percent'] /100 , 2) .",".$row['clear'].",".$row['gl_num']; echo "<br />"; } ?> Link to comment https://forums.phpfreaks.com/topic/179627-solved-results-of-query-to-0-are-ignored/ Share on other sites More sharing options...
Mark Baker Posted October 30, 2009 Share Posted October 30, 2009 $query = "SELECT sunocoimport.duns_num, custmast.gl_num, custmast.division_num, custmast.customer_num, sunocoimport.summary_date, sunocoimport.cc_fees, custmast.fee_percent, custmast.clear FROM sunocoimport, custmast WHERE sunocoimport.duns_num = custmast.duns_num AND (sunocoimport.cc_fees * custmast.fee_percent / 100) <> 0"; Link to comment https://forums.phpfreaks.com/topic/179627-solved-results-of-query-to-0-are-ignored/#findComment-947805 Share on other sites More sharing options...
smerny Posted October 30, 2009 Share Posted October 30, 2009 // Make a MySQL Connection // Construct our join query $query = "SELECT sunocoimport.duns_num, custmast.gl_num, custmast.division_num, custmast.customer_num, sunocoimport.summary_date, sunocoimport.cc_fees, custmast.fee_percent, custmast.clear FROM sunocoimport, custmast WHERE sunocoimport.duns_num = custmast.duns_num"; $result = mysql_query($query)or die(mysql_error()); // Print out the contents of each row into a table while($row = mysql_fetch_array($result)){ if($row['cc_fees'] * $row['fee_percent'] > 0) { echo $row['division_num'].",".$row['customer_num'].",".$row['summary_date'].",".round($row['cc_fees'] * $row['fee_percent'] /100 , 2) .",".$row['clear'].",".$row['gl_num']; echo "<br />"; } } ?> edit: use marks way, it just doesn't pull that info from the db to begin with Link to comment https://forums.phpfreaks.com/topic/179627-solved-results-of-query-to-0-are-ignored/#findComment-947807 Share on other sites More sharing options...
travelkind Posted October 30, 2009 Author Share Posted October 30, 2009 Great guys it works! Thanks a lot for your help. Link to comment https://forums.phpfreaks.com/topic/179627-solved-results-of-query-to-0-are-ignored/#findComment-947813 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.