I am trying to figure this out, I want to call several rows say in the range of 5 - 40 from mysql. I then would like to take the four variables in each row and use them in php in a foreach statement.
I was hoping someone might be bale to give me a hand. This is the code I am working with right now.
include ('php/opendb.php');
$frontad_mysql = mysql_query("SELECT title, city, ad_image, rent FROM rentals WHERE front_page_ad = '1' AND paid = '1' ") or die(mysql_error());
$front_ads = array();
while($front_ads = mysql_fetch_assoc($frontad_mysql)) {
$front_ads[] = $row;
}
$ads = "<div id='ad_container'>";
$x = 0;
foreach ($front_ad as $fa){
$ads .= "<div id='$x' class='front_ads'>".$fa['$x']['title']."<br/><img src='".$fa['$x']['ad_image']."' class='frontad_image' /><br/>".$fa['$x']['city']."<br/>Price: $".$fa['$x']['rent']."</div>";
}
$ads .= "</div>";
mysql_close();
Any help is greatly appreciated - Thanks