value of unexisting row from mysql_result()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pco
Forum Newbie
Posts: 2
Joined: Wed Sep 06, 2006 5:09 pm

value of unexisting row from mysql_result()

Post by pco »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


if $watch=3

Code: Select all

while ($watch > 0) {

$sql="SELECT * FROM table WHERE id='$watch' ;";
$result = mysql_query($sql);
$output=mysql_result($result,0,'xcolumn');
$watch=$watch-1;
}
Ask

for $watch=1,3 i got $result ==> resource #xx and $output ==> correctly

if $watch=2 is not exising in the table

what is a value of $result and $output ??

i need it be existing for me to continue other part plz.


Novice from Thailand,


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Technically, $result should be "resource #XX" as per the other ones.

$output on the other hand should be "false" (the boolean value, not the string) if 2 isn't a record. A warning may be fired too.
pco
Forum Newbie
Posts: 2
Joined: Wed Sep 06, 2006 5:09 pm

Post by pco »

arrhhh

thank you :D

i'll find the way to use the boolean value.
Post Reply