Jump to content

Recommended Posts

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);
}
?>

Link to comment
https://forums.phpfreaks.com/topic/151486-solved-coders-block-and-issue/
Share on other sites

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 />";
}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.