[RESOLVED] Mysql multiple rows and separate using php
I am trying to find a way to pull multiple rows from a database and than be able to separate the rows and use them in php.
PHP Code:
$result = mysql_query("SELECT url, image, placement FROM advert
WHERE user='1'") OR die(mysql_error());
//This grabs 3 rows with placement name equal to 'sideadtop','sideadmiddle','sideadbottom'
($row = mysql_fetch_array($result, MYSQL_NUM));
$keytop = array_search('sideadtop', $row);
$sideadtop['url'] == $row[$keytop]['url'];
$sideadtop['image'] == $row[$keytop]['image'];
$keymiddle = array_search('sideadmiddle', $row);
$sideadmiddle['url'] == $row[$keymiddle]['url'];
$sideadmiddle['image'] == $row[$keymiddle]['image'];
I am trying to get the url and image values for each ad placement value. Should I be using mysql to pull individual rows or use php to separate them if possible. Or is there a better way to do this?
Any help is appreciated
Thanks