未知错误未定义的索引:第7行的/var/www/vhosts/semanticnotion.com/httpdocs/fish/allmycatch.php中的catch_id

时间:2011-01-03 06:05:10

标签: php

我正在从mysql中检索数据。在网络浏览器中,它工作得很完美,但是当我在终端中检查网址时,它会给我以下错误。

Undefined index:  catch_id in /var/www/vhosts/semanticnotion.com/httpdocs/fish/allmycatch.php on line 7

您还可以使用此命令在浏览器和终端中查看我的网址http://semanticnotion.com/fish/allmycatch.php?ud_id=123456789&catch_id=8

curl http://semanticnotion.com/fish/allmycatch.php?ud_id=123456789&catch_id=8

您将在终端中看到错误消息 我的代码在下面

$ud_id=$_GET['ud_id'];
$catch_id=$_GET['catch_id'];
$query="SELECT catch_id,catch_name,catch_details,longitude,latitude,time,image
FROM user u
LEFT JOIN mycatch m ON u.user_id = m.user_id
WHERE u.ud_id ='$ud_id' AND m.catch_id >'$catch_id'";
$result1 = mysql_query($query);
//while ($table = mysql_fetch_array($result1, MYSQL_ASSOC)){
while ($table = mysql_fetch_assoc($result1)){

1 个答案:

答案 0 :(得分:2)

shell将&解释为命令分隔符。你需要引用/转义论证。

curl 'http://semanticnotion.com/fish/allmycatch.php?ud_id=123456789&catch_id=8'