【发布时间】:2011-12-14 10:55:10
【问题描述】:
我在 index.php 页面中没有看到任何数据。我使用此代码从具有唯一 ID 的 mysql 数据库中获取数据,但我不能。
include "db/db.php";
$upload_path = "secure/content/blogpostimg";
<?php
if (isset($_GET['post_id']) && $_GET['post_id'] != '')
{
$p_id = (int) $_GET['post_id'];
}
$sql = mysql_query("SELECT * FROM blog_post WHERE post_id = '$pid' ORDER BY post_id
DESC ");
while ($rel = mysql_fetch_assoc($sql))
{
$id = $rel['post_id'];
$sub = $rel['subject'];
$imgname = $rel['img_name'];
$msg = $rel['message'];
$date = $rel['date'];
$poster = $rel['poster'];
$cat_name = $rel['cat_name'];
echo "<h1>". "$sub" ."</h1>". "<br/>";
echo '<img src="' . $upload_path . '/' . $imgname . '" width="200" /> ';
include_once("func.php");
echo truncate($rel['message'],"index.php","post_id",$rel['post_id']);
echo "$date " . "<b>Category:</b>
$cat_name". " ". "<b>by:</b> " . "$poster " .
"<b>Comemnts</b>[ ]" ;
}
?>
【问题讨论】:
-
您发布的代码无效。请尝试发布工作代码。
-
这是我的 index.php 代码。 dawamedical.com/index.txt
-
这段代码的输入错误似乎太多
-
您也是打字新手吗?只有你需要的只是仔细粘贴你正在使用的实际代码。
-
你确定数据库连接正常吗?