Caffeinenyx Posted May 5, 2011 Share Posted May 5, 2011 I know im being blind today but can someone point out why: $query = "SELECT peopleID FROM numpeople WHERE ID = '3';"; $result = mysql_query($query) or die("failed."); $row = mysql_fetch_row($result); $numpeople = mysql_num_rows($result); echo "<br /> row $row[1]"; echo "<br />numpeople $numpeople"; $numpeople returns 2, but $row[1] is undefined? $row[0] is fine. (The value of $row[0] is 7 and $row[1] should be . This is the second error that I really cant see.... Link to comment https://forums.phpfreaks.com/topic/235646-row1-undefined-mysql_num_rows-2/ Share on other sites More sharing options...
Pikachu2000 Posted May 5, 2011 Share Posted May 5, 2011 You're only selecting one field, and array indices start at 0 , not 1 . . . Link to comment https://forums.phpfreaks.com/topic/235646-row1-undefined-mysql_num_rows-2/#findComment-1211159 Share on other sites More sharing options...
Caffeinenyx Posted May 5, 2011 Author Share Posted May 5, 2011 loops, sorry i am very over tried, I cant believe the mistakes I have made this evening. Thanks. Link to comment https://forums.phpfreaks.com/topic/235646-row1-undefined-mysql_num_rows-2/#findComment-1211161 Share on other sites More sharing options...
dodgeitorelse Posted May 5, 2011 Share Posted May 5, 2011 1 too many semicolons? Link to comment https://forums.phpfreaks.com/topic/235646-row1-undefined-mysql_num_rows-2/#findComment-1211162 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.