murfitUK Posted December 27, 2008 Share Posted December 27, 2008 I'm stuck!The query is "SELECT * FROM users,messages WHERE users.id=messages.from AND messages.read=0;"I do the usual connection, run query then use a while loop: WHILE ($row = mysql_fetch_array($result)).How do I print the results from the $result array? By this I mean suppose I want the field users.username or messages.datesent? At the moment I have to do print "<pre>; print_r ($result) etc and try to find the index eg $row[3] or $row[6] etc. Obviously if I then add or remove a field to either of the tables this number will change.I've tried print $(row['users.username']) and $row['users'.'username'] and $row['users']['username'] and all possible combinations but can't get it.Anyone help? Link to comment Share on other sites More sharing options...
jeffman Posted December 28, 2008 Share Posted December 28, 2008 Try using $row = mysql_fetch_assoc($result) instead, and then print_r($row), so you can see what the indexes actually look like. Then you'll know how to look for them. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.