This is probably so basic and obvious but I can't get it all.
I'm trying to create a page that is called by article.php?id=x.
I need to pull a row from a database where the id value is equal to x.
This is the code I have:
<?php $dbh=mysql_connect ("localhost", "xxxxx", "xxxxxx") or die ('I cannot connect to the database because: ' . mysql_error());
$selectdb = mysql_select_db("medw1974_articles",$dbh);
$query = mysql_query("SELECT * FROM articles WHERE id=$_GET[id]");
while($row = mysql_fetch_array($query))
{
echo ".$row[title].";
}
?>
However this returns the following error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/medw1974/public_html/article.php on line 27
Any help would be much appreciated
Michael