$cards = "SELECT url,alttext FROM cards where deny=0 ORDER BY rand() LIMIT 4";
$cardr = mysql_query($cards) or die(mysql_error());
while ($row = mysql_fetch_array($cardr)) {
echo "<img src=\"{$row['url']}\" alt=\"{$row['alttext']}\" /> ";
}
I'm using the above code to get 4 rows from a table, i know it works since it displays 4 images.
i now need to take the url and alttext and put them into this insert query
$sql = "INSERT INTO auction_items
VALUES (
'NULL',
'Darkness Within',
'alttext1',
'alttext2',
'alttext3',
'alttext4',
'url1',
'url2',
'url3',
'url4',
'5',
'5',
'0',
'".date("Y-m-d H:i:s")."',
'".$enddate."',
'0'
)";
replaceing url and alttext with the information from the 4 rows
alttext1/url1 is for the first image gotten
alttext2/url2 is for the second image
same for 3 and 4
I think its possible to do it via an array, but am unsure if its the best solution, and unsure about how to add each item rather than overwrite them