I am trying to add a database to our website to make updating etc easier using php. I have managed to get it to output the results but they all blend in, can someone help in making the class change for every other entry please?
Here is what I have
The above will make all of the results the same, to change the background color of every other result I can change the class to 'second'. As you can see I am also trying to grab the number of results, am I on the right track with that?
Thanks
Here is what I have
Code:
<?php include("dbconn.php"); ?>
<?php
$query = "SELECT * FROM properties";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "<div class='first'>{$row['name']}, {$row['address']}</div>" ;
}
//now grab the number of results for the field below
$query = "SELECT COUNT(*) FROM properties";
$result = mysql_query($query);
$returned = mysql_fetch_array($result, MYSQL_ASSOC)
?>
There are <?php echo {$returned['*']} ?> results.
The above will make all of the results the same, to change the background color of every other result I can change the class to 'second'. As you can see I am also trying to grab the number of results, am I on the right track with that?
Thanks