Q695 Posted March 28, 2009 Share Posted March 28, 2009 There is no data, so shouldn't it be saying that you don't have anything in a way instead of death? output:SELECT * FROM `map` WHERE `location_x`='-3' AND `location_y`='3' AND `level`='1'; <?php function loc_img ($mx, $my, $location_x, $location_y){ global $location_x, $location_y, $level; $location2_x=$location_x+$mx; $location2_y=$location_y+$my; $sql="SELECT * FROM `map` WHERE `location_x`='$location2_x' AND `location_y`='$location2_y' AND `level`='$level';"; $result=@mysql_query($sql,$con) or die(death($sql)); $m_row=mysql_fetch_array($result); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/151486-solved-coders-block-and-issue/ Share on other sites More sharing options...
Mchl Posted March 28, 2009 Share Posted March 28, 2009 Why don't you display mysql_error? Quote Link to comment https://forums.phpfreaks.com/topic/151486-solved-coders-block-and-issue/#findComment-795677 Share on other sites More sharing options...
corbin Posted March 28, 2009 Share Posted March 28, 2009 Just a guess, but I don't see $con set anywhere. Quote Link to comment https://forums.phpfreaks.com/topic/151486-solved-coders-block-and-issue/#findComment-795950 Share on other sites More sharing options...
Q695 Posted March 28, 2009 Author Share Posted March 28, 2009 $con=//universal connection to database death doesn't output an error, even though it has a mysql_error() built in. Quote Link to comment https://forums.phpfreaks.com/topic/151486-solved-coders-block-and-issue/#findComment-795966 Share on other sites More sharing options...
corbin Posted March 28, 2009 Share Posted March 28, 2009 Errr.... You're not declaring it global. Quote Link to comment https://forums.phpfreaks.com/topic/151486-solved-coders-block-and-issue/#findComment-795983 Share on other sites More sharing options...
Mchl Posted March 28, 2009 Share Posted March 28, 2009 At least remove the error suppresion from mysql_query Quote Link to comment https://forums.phpfreaks.com/topic/151486-solved-coders-block-and-issue/#findComment-796002 Share on other sites More sharing options...
PFMaBiSmAd Posted March 28, 2009 Share Posted March 28, 2009 A query that executes but has zero rows in the result set is a successful query. Only queries that fail to execute return a FALSE value that would trigger an or die() statement. To test if there were any rows returned you would need to use mysql_num_rows() or put the $m_row=mysql_fetch_array($result) inside of a conditional statement - if($m_row=mysql_fetch_array($result)){ // fetch worked, process $m_row here } else { // no row to fetch echo "zero matching rows<br />"; } Quote Link to comment https://forums.phpfreaks.com/topic/151486-solved-coders-block-and-issue/#findComment-796011 Share on other sites More sharing options...
Q695 Posted March 29, 2009 Author Share Posted March 29, 2009 Thanks, that worked PFM . Quote Link to comment https://forums.phpfreaks.com/topic/151486-solved-coders-block-and-issue/#findComment-796449 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.