Jump to content

Retrieving Array Results Following A Join


murfitUK

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...