我有這樣一段代碼:麻煩鏈接到一個MySQL表
<?php
include('base.php');
?>
<?php
if(isset($_GET['MomentEvent']))
{
$MomentEvent = intval($_GET['MomentEvent']);
$dn = mysql_query('select TitreEvent, DescriptionEvent from users_event where MomentEvent="'.$MomentEvent.'"');
if(mysql_num_rows($dn)>0)
{
$dnn = mysql_fetch_array($dn);
?>
我的問題是鏈接到users_event表從未和:
«對不起TitreEvent未找到»
消息總是彈出在我的臉上。我究竟做錯了什麼?
編輯:完整的代碼
<?php
include('base.php');
?>
<?php
if(isset($_GET['MomentEvent']))
{
$MomentEvent = intval($_GET['MomentEvent']);
$dn = mysql_query('select TitreEvent, DescriptionEvent from users_event where MomentEvent="'.$MomentEvent.'"');
if(mysql_num_rows($dn)>0)
{
$dnn = mysql_fetch_array($dn);
?>
This is the profile of "<?php echo htmlentities($dnn['TitreEvent']); ?>" :
<table style="width:500px;">
<tr>
<td><?php
if($dnn['avatar']!='')
{
echo '<img src="'.htmlentities($dnn['avatar'], ENT_QUOTES, 'UTF-8').'" alt="Avatar" style="max-width:100px;max-height:100px;" />';
}
else
{
echo 'This user dont have an avatar.';
}
?></td>
<td class="left"><h1><?php echo htmlentities($dnn['TitreEvent'], ENT_QUOTES, 'UTF-8'); ? ></h1>
Email: <?php echo htmlentities($dnn['DescriptionEvent'], ENT_QUOTES, 'UTF-8'); ?><br />
</tr>
</table>
<?php
}
else
{
echo 'Sorry TitreEvent not found';
}
}
else
{
echo 'The user ID is not defined.';
}
?>
</body>
</html>
好像你遺漏了很多你的代碼在這裏在這裏你的錯誤 – JohnnyFaldo
糊,有沒有任何錯誤(如果沒有,你一定錯誤報告是)?其次,是'$ _GET ['MomentEvent']'集合? –
第一個問題 – newfurniturey