Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 链接到MySQL表很麻烦_Php_Mysql_Hyperlink - Fatal编程技术网

Php 链接到MySQL表很麻烦

Php 链接到MySQL表很麻烦,php,mysql,hyperlink,Php,Mysql,Hyperlink,我有一段代码: <?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.

我有一段代码:

<?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);
             ?>


你的报价太多了。试试这个

$dn = mysql_query("select TitreEvent, DescriptionEvent from users_event where  MomentEvent=$MomentEvent ");

似乎您丢失了很多代码粘贴在此处您的错误第一个问题是,是否有任何错误(如果没有,是否确定已打开错误报告)?其次,
$\u GET['MomentEvent']
设置了吗?是的,它在另一页上设置了。@freddy,这听起来像是你的问题。为了验证,是否在URL的查询字符串(如
http://domain/somepage.php?MomentEvent=15
或者你正在做类似于
$\u GET['MomentEvent']=15在另一个页面上?看起来你的问题是你用单引号打开,然后用双引号关闭。
$dn = mysql_query("select TitreEvent, DescriptionEvent from users_event where  MomentEvent=$MomentEvent ");