I am trying to access a mysql database and pull out all lines of code that have a certain value (i.e. an email).
I am using $result=mysql_query($query); and then $row=mysql_fetch_array($result); to get the results and store them in an array.
I know that from there I can access the data with $row[’email’] if it’s only one line…but if there are multiple lines in the array, how do I access those? For example, can I do:
$var1 = $row['email'][0];
$var2 = $row['email'][1];
etc.? Is this the right syntax? If I wanted to put this value back into Mysql, could I UPDATE ...where email = '$row['email'][1]'"; or do I need it to be a simple variable like $var1?
Thank you!
mysql_fetch_array()gets the next row each time you call it to get the rest of them you have to loop through them like: