Page 1 of 1

databse fetch problem

Posted: Fri Jan 02, 2004 9:32 am
by vigge89
This is how my mysql_fetch_row code looks like:

Code: Select all

<?php
$sql3 = "SELECT level FROM keeper WHERE nick = '$usrname'";
$result3 = @mysql_fetch_row( @mysql_query($sql3));
?>
The level field is an indeger(1) and where username = vigge , it's set to '5'.
However, $result[0] contains '1', and not '5'. Could anyone help me solve this mystery?

Posted: Fri Jan 02, 2004 9:38 am
by JAM
Hard when we cant see the rest of the table-content.
This should get a) error messages if there is something wrong, b) a result that should becorrect, if it's correct in the table as you say.

Code: Select all

<?php
    // Felstavning? (username)
   $result = mysql_query("SELECT level FROM keeper WHERE nick = '$usrname'") or die("Could not query:" . mysql_error());
   echo mysql_result($result, 0);
?>
Using mysql_result() to automaticly fetch the result abit faster.

Posted: Fri Jan 02, 2004 12:18 pm
by vigge89
No error, but the field 'level' is set to '5' where nick = 'vigge'
Contents of table 'keeper':
Image