Help, been trying to get this to work for a couple hours now...
I have a database that contains news for my website. The first field is title, the second is date, and the third is content.
Well, I am trying to write a class that will be the template for my site. Almost got it done, but I need to get the news from the database into an array. Not one row of the news, all the rows of the news in one array. Here is how I get the news out of the db:
$db = mysql_connect ("$host", "$user", "$pass") or Die("Could Not Connect");
$query = "SELECT title, DATE_FORMAT(dateTime, '%W %M %e, %Y'), newsMain FROM news ORDER BY dateTime DESC;";
$results = mysql_db_query("$dbName", "$query") or Die("Unable to select news");
while ($row = mysql_fetch_array ($results))
But this only gets things out one row at a time. I also need to store the array into a variable. I tried:
while ($row = mysql_fetch_array($results))
{
$row .= $row;
}
Doesn't work, or if it does how do I get it into a variable?
If anyone can help me, THANKS! I appreciate it.
Chad