I'm working on a beer review site. I need a page that can draw data from my db and input it into an html, but different info for different beer pages. It's similar to facebook's system for profiles. This doesn't include the html it's just , but I am getting the error as follows:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource ....on line 15
Oh and my DB connect info DOES work, just edited to not reveal info
PHP Code:
<?php
$con = mysql_connect("********","*******","******"); //connects to DB
if (!$con)
{
die('COULD NOT CONNECT! ' . mysql_error());
}
($_GET['id']);
$id = $_GET['id'];
$sql = mysql_query("SELECT * FROM 'beers' WHERE id='$id'");
while($row = mysql_fetch_array($sql)){
$beername = $row['beername'];
$date = $row['date'];
$style = $row['style'];
$brewer = $row['brewer'];
}
?>
I know this is total newb stuff, but what am I doing wrong? I've looked at other forums with this error but cannot find a problem that fits it. Basically, I am just trying to declare these variables so as to use them later in an html file. Any help would be greatly appreciated. Thanks folks!