I am working on my website, and I am trying to get the url parameter "page" which is an integer that tells which entry to read in the MySQL database that hols the HTML for all the pages. Here is my code, with the MySQL username and password removed for security reasons:
if ($_GET["page"]) {
$con = mysql_connect("localhost","username","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("jmurano_pages", $con);
$title=mysql_query("SELECT title FROM pageContent WHERE pageID=" . $_GET['page']);
echo "<title>" . $title . "</title>\n";
echo "</head>\n";
echo "<body>\n";
$content = mysql_query("SELECT content FROM pageContent WHERE pageID=" . $_GET['page']);
echo $content;
echo "\n</body>\n</html>";
}
This puts the title as "Resource id #2" and the content as "Resource id #3". I can't think of what I may have done wrong.