I have a php script where I need to select all the columns of a certain row in a table in my db but it’s not working. I have another page where I have a link like this:
[b]
And when they click on that link they get sent to page.php with the var of ’23’ and I have a hidden field like so:
[b]<input type=”hidden” name=”id” value=”<?php $var = $_GET[‘id’]; echo $var; ?>” />
Which I use to retrieve the var. And then I refrence that hidden field in my script to try to display the row from the db table that has that id. Here is my script:
[code=php]<?php
include “config.php”;
mysql_connect($mysqlserv,$mysqluser,$mysqlpass);
mysql_select_db($mysqldbname);
$id = $_POST[‘id’];
$query = “SELECT * FROM news WHERE id = ‘$id'”;
$result = mysql_query($query);
while (list($id,$title,$time,$body) = mysql_fetch_row($result)){
echo “<div class=”mid”><p><b>Title:</b> $title<br /><b>Date:</b> $time<br /><b>Body:</b> $body</p></div>n”; }
?>
But like I said before, the script above doesn’t work for some reason. I go to the link on the one page and it is just blank on the next page. I’m not sure whats wrong but hopfully you guys can help. ?