Mr_Cat - 12:05 pm on Feb 12, 2012 (gmt 0)
Right, I was struggling a bit with the concept of exactly what an array is. I was looking at it that an array is something that contains a collection of data that's been retrieved from the database.
If field2 contains "info" and field3 contains "moreinfo"
$query = "SELECT field2, field3 FROM table1 WHERE row_ID = 7";
$result = mysql_fetch_array($query);
$info = $result['info'];
$moreinfo = $result['moreinfo'];
makes sense to distinguish the different data
but if I just want one little bit, "info" I didn't quite get why I had to put it in an array and then get it out again, whether there was something other than 'fetch_array' I should be using instead, and why $result didn't just automatically = "info" given there's nothing else in it rather than 'resource ID#2' or something similar when you try and echo it.
Sorry to be a bit slow on the uptake, I've looked at the manual, but when you say
It's worth noting that in your example, 'field2' would be returned in 2 array values
You mean it returns the id and the data as 2 values?
It's making more sense now tho :) Thanks!