Hi guys, i need a little help please.
I have a bunch of data loaded from a MySQL database, and i want to display it in a dynamic table.
Here is my code
<?php
$location = "localhost";
$username = "cape";
$password = "e******";
$database = "cape_program";
$dirname = "wizard/data/";
$conn = @mysql_connect($location,$username,$password);
mysql_select_db($database,$conn) or die ("Could not open database");
$query = "SELECT id,address,city,state,zip,description,price,tn FROM db_x WHERE listing='land'";
$exec = mysql_query($query,$conn) or die('MySQL said: ' . mysql_error());
$result = mysql_fetch_assoc($exec);
if (mysql_num_rows($exec) > 0){
$row = mysql_num_rows($exec);
echo '<table width="400" border=0 align=center cellpadding="0" cellspacing="0">';
while ($row = mysql_fetch_array($exec, MYSQL_NUM)) {
echo '<tr onMouseOver="this.bgColor = '.'#C0C0C0'.'" onMouseOut ="this.bgColor = '.'#FFFFFF'.'" bgcolor="#FFFFFF">
<td width="62"><img src="wizard/data/'.$result['tn'].'"></td>
<td width="337">'.$result['address'].', '.$result['city'].', '.$result['state'].', '.$result['zip'].'<br>'.$result['description'].'</td>
</tr>';
}
}
else{
echo 'Something went wrong, and the listings can not be loaded <br> Please contact technical support';
}
echo '</table>';
?>
The good news:
If there are lets say 11 listings, it will print the correct data 11 times
The bad news:
It prints the first set of data 11 times, instead of the 11 different sets...
Can anyone please assist me, i really appriciate your time.
Thank you,
~Gabor Szauer