您好,我已经写了这个代码,以获得来自url的新闻ID,并显示从这个存储在MySQL中的ID的新闻结果。我不知道我做错了什么。但我得到任何输出。我也测试了我的查询,它在mysql中运行正常。我正在做一些无法识别的小错误,可能是某处的语法或引用。谢谢。
这是我的网址:
http://autodo/admin/news.php?id=2043这是我的代码:
$ID=$_GET['id'];
$sql=" SELECT DISTINCT ad_news.datum, ad_news_texte.text, ad_news_texte.headline, ad_news_texte.id
FROM autodo.ad_news_texte, autodo.ad_news
WHERE ad_news_texte.id =".$ID."
GROUP BY ad_news_texte.text, ad_news_texte.headline, ad_news_texte.id";
echo $sql_select=mysql_query($sql);
if($row = mysql_fetch_assoc($sql_select)){
$news_id= $row['id'];
$news_datum= $row['datum'];
$news_text= $row['text'];
$news_headline= $row['headline'];
?>
= $news_datum ?>
= $news_headline ?>
= $news_text ?>
} ?>