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.... Quote 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 . . . Quote 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. Quote 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? Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.