Hi!
Still learning the ropes of PHP/MySQL here so pardon if this is something from a 101 class. :p
I am wanting to know if/how I can query a MySQL database, pull two rows of information and assign them individual variable names. I know this isn't too clear. Let me try to explain what I want to do...
Let's say I have something similar to this:
$query = mysql_fetch_assoc(mysql_query("SELECT entry_id, user_id, date FROM my_entries WHERE user_id = '$user_info[user_id]' ORDER BY date DESC LIMIT 2"));
What I would like to be able to do is assign separate variables for the info on the two rows returned by the query. I want to have the following variables:
$first_date = $query[date]; <= from the first row
$second_date = $query[date]; <= from the second row
I can then use the two variables to compare to each other, etc.
Can this be done with a single query? Or are two queries required (if so how)?
Any help would be greatly appreciated!
Sanch