I need some help with the following code...
How do I create the array from a mysql db:
I have already created the connection set: I want to get the data for my domain from the db, this I can do - My problem is mainly how to create the loop...
<?php
// Each sponsor is an element of the $sponsors array:
$sponsors = array(
array('domain1.com','The biggest social network in the world.','http://domain1.com/'),
array('domain2.com','Imaging and optical technology manufacturer.','http://domain2.com/'));
// Randomizing the order of sponsors:
shuffle($sponsors);
?>
I have tried to do it like this:
do {
array(''.$row_rs_domainrecord['g_sites_image'].'','The biggest social network in the world.',''.$row_rs_domainrecord['g_sites_url'].''),
} while ($row_rs_domainrecord = mysql_fetch_assoc($rs_domainrecord)););
but get an error here
But are not getting the results and get an error $sponsors = array(
What would be the easiest way to greate this loop?
Thanks
''.$row[...].''
is nonsense, it's the same as$row[...]
. – deceze♦ May 19 '11 at 3:36