Wow. I haven’t been on this board in years. I forgot my username and password. How sad. LOL. Okay…so here’s my dilemma. It’s been a long time since I’ve done mysql functions in php, and I came up with the code below. I keep getting a mysql_query() is not a valid mysql-link resource error. I’ve looked at this…even recoded it…played with quotations (I’ve seen them be an issue on some servers…no idea why)…all until I’m about blue in the face. I need some fresh eyes. I’ve spent too long with this. LOL. Is there something I’ve overlooked?
<?php
$dbuser = "<blanked out for security reasons>";
$dbpass = "<blanked out for security reasons>";
$hostname = "<blanked out for security reasons>";
$database = "tophywww";
$dbinterface = mysql_connect($hostname,$dbuser,$dbpass) or die("Could not connect." . mysql_error());
$db = mysql_select_db($database,$dbinterface) or die("Could not execute." . mysql_error());
$table = "news";
$newsq = "select * from $table order by date desc ";
$start = "0";
$rownum = "3"; //Number of entries to display
$newsq .= "limit $start,$rownum";
$result = mysql_query($newsq,$db) or die("Could not execute : $newsq." . mysql_error());
while ($news = mysql_fetch_array($result))
{
$title = $news["title"];
$date = $news["date"];
$user = $news["username"];
$text = $news["text"];
}
?>