0

有人可以帮我处理这个查询吗?每当我运行这个查询时,页面都不会加载。我很确定这是一个非常简单的错误,我无法弄清楚。非常感谢您的帮助。

$aggr_nr = $_REQUEST['stck_list_nr_01'].$_REQUEST['stck_list_nr_02'].$_REQUEST['stck_list_nr_03'];
echo $aggr_nr;

$sql="SELECT v.id FROM vers_einl_aggregatnummer AS v WHERE v.aggr_nr = $aggr_nr";
$aggr_id = mysql_query($sql);

if ($aggr_id == true)
 {
        echo "query 1 executed".$aggr_id;
    else  
    {
    echo("<br />Could not execute statement ".$sql);
    }
 }
4

3 回答 3

0

只需说一下未显示 ( ) 的 PHP 错误page doesn't load up

您可以将 PHP 配置为在错误时停止而不显示它。这应该是生产服务器上的默认设置,以便在出现错误时不显示太多内部信息。

您可以使用这些行来显示所有错误,但不要忘记再次将其关闭;)

ini_set('display_errors', 1);
error_reporting(E_ALL);
于 2012-10-26T09:17:45.293 回答
0

有一个语法错误看看这个

if ($aggr_id != false)//since on success resource type is returned.
{
 echo "query 1 executed".$aggr_id;
}else  
{
  echo("<br />Could not execute statement ".$sql);
 }

$aggr_nr = $_REQUEST['stck_list_nr_01'].$_REQUEST['stck_list_nr_02'].$_REQUEST['stck_list_nr_03'];
echo $aggr_nr;
if(isset($aggr_nr)&&is_numeric($aggr_nr))
{
$aggr_nr=mysql_real_escape_string($aggr_nr);

$sql="SELECT v.id FROM vers_einl_aggregatnummer AS v WHERE v.aggr_nr = $aggr_nr";
$aggr_id = mysql_query($sql);
}
于 2012-10-26T08:42:11.067 回答
0
//sanitize the inputs 
$aggr_nr = mysql_real_escape_string($_REQUEST['stck_list_nr_01'].$_REQUEST['stck_list_nr_02'].$_REQUEST['stck_list_nr_03']);
 echo $aggr_nr;

$sql="SELECT v.id FROM vers_einl_aggregatnummer AS v WHERE v.aggr_nr = '".$aggr_nr."'";//missing Quotes
$aggr_id = mysql_query($sql);

if ($aggr_id) {
 while($result = mysql_fetch_array($aggr_id))
   echo "ID NUMBER:".$result['id'];
}  else {
   echo "<br />Could not execute statement ".$sql;
}
于 2012-10-26T08:45:19.577 回答