Hi all, I am trying to select multiple rows from the database and then separate the rows into array values so I can use them throughout my code.
This is what I have right now...
$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. I am not sure how the output for the mysql query is sent to php. Is it sent as a multideminsional array or just a array?
Is there a better way to achieve this?
Thanks so much and have a good weekend!