PHP / MySQL call ID issue

ساخت وبلاگ
Hi

I wonder if someone can help me with an issue that has left me scratching my head...

I have a simple page which appears as a pop-up which calls data from a MySQL database, e.g. http://www......./popup.php?id=5 (this would call the database entry with ID number 5).

The code on the page is as follows (slightly simplified for here):

<?php
include('../config.php');
$sql = "SELECT * FROM `$filename` WHERE id = '$id'";
$sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql);
while ($row = mysql_fetch_assoc($sql_result)) {
if ($row["content"]<>'') {
echo nl2br(stripslashes(html_entity_decode($row["content"]))).'';
};
};
?>

The problem that I appear to have is WHERE id = '$id'. If I add a number manually and do a test (e.g. WHERE id = '5') it sill show the 'content', but not if is calling the content from the id included in the URL. Can anyone point me in the right direction?

Thanks in advance
Neil
CodingForums...
ما را در سایت CodingForums دنبال می کنید

برچسب : نویسنده : codingforums بازدید : 162 تاريخ : جمعه 29 دی 1396 ساعت: 20:42