Forum Moderators: coopster
I just fixed an error. I had to put in a period behind an array. Now, it is just giving me a blank page.
How, come this isn't working. I am not advanced in mysql coding..
mysql_connect($hostname,$username, $password) OR DIE ('Unable to connect to database! Please try again later.');
mysql_select_db($dbname);
$query = 'SELECT * FROM $usertable';
$result = mysql_query($query);
if($result) {
while($row = mysql_fetch_array($result)){
$imagelink = $row["imagelink"];
$deallink = $row["deallink"];
$linktitle = $row["linktitle"];
$dealdescription = $row["dealdescription"];
$expires = $row["expires"];
$couponcode = $row["couponcode"];
echo "<tr>\n";
echo "<td width=150 valign=top>\n";
echo "<img src=".$imagelink.">";
echo "</td>\n";
echo "<td>\n";
echo "<font face=verdana size=4><a href=".$deallink.">".$linktitle."</a></font><br>\n";
echo "<font face=arial size=3>".$dealdescription."</font><br>\n";
echo "<font face=verdana size=3><b><u>Expires</u>: </b>".$expires."</font> ";
echo "<font face=verdana size=3><b><u>Coupon Code</u>: </b></font>";
echo "<font face=verdana size=3>".$couponcode."</b></font><br><br>";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
}
}
?>
$query = 'SELECT * FROM $usertable';
and now that I look at that again, if it is a variable it won't get resolved inside single quotes so try this way
$query = "SELECT * FROM $usertable";
and if that doesn't work then try adding an or die to your query
$result = mysql_query($query) or die (mysql_error());