السلام عليكم
مشكلتي هي مع كود php
قمت بعمل كود ليقوم بالتالي
يأخذ قيمة
من الرابط ثم يقوم باحضار الصف من قاعدة البيانات الذي يحمل نفس رقم ال id
والكود
كود PHP:
<html>
<meta charset="utf-8">
</html>
<?php
include ('config.php');
$id=$_get["id"];
if (!$result) {
die('Query failed: ' . mysql_error());
}
$sql = ('SELECT id as id, filename, link
FROM link
WHERE id =$id');
$result = mysql_query ($sql);
if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
if (mysql_num_rows($result) == 0) {
echo "No rows found, nothing to print so am exiting";
exit;
}
// While a row of data exists, put that row in $row as an associative array
// Note: If you're expecting just one row, no need to use a loop
// Note: If you put extract($row); inside the following loop, you'll
// then create $userid, $fullname, and $userstatus
while ($row = mysql_fetch_assoc($result)) {
echo $row["id"];
echo $row["filename"];
echo $row["link"];
}
mysql_free_result($result);
?>
ولكن مشكلتي عند ال$id في السطر 12 انها مكتوبة داخل string ولهاذا لا تعطي قيمة فكيف اجعلها تعطي قيمة