So I'm trying to get something to work. I have a mySQL database called 'news' with a table called 'news', I have a page called 'news.php' that is meant to display single entries depending on what is put in the address bar. This is the news.php page:
PHP Code:
<html>
<head>
<?php
$id = (int)$_GET['id'];
$sql = "SELECT entry FROM news WHERE id='$id'";
?>
</head>
<body>
<p>The entry you have chosen will (hopefully, seeing as this is a test) be displayed below:
<p><?php echo $sql; ?>
</body>
</html>
I can get it so it can take the number from the URL but I can't get it to display the entry I'm trying to display. What do I need to do to this page to make it so when you type 'http://www.mywebsite.com/news.php?id=1' into the address bar the entry with id number 1 will show up on the page? The details of my table are as follows: There are two columns in this table, they are called 'id' and 'entry'. The entry field is where the text I'm trying to get to display is. There is only one entry with an id of 1 and the entry contains the word 'john'.