2011-01-03 3 views
0

mysql에서 데이터를 가져옵니다. 웹 브라우저에서 완벽하게 작동하지만 내 터미널에서 URL을 확인하면 다음과 같은 오류가 발생합니다.알 수없는 오류 정의되지 않은 색인 : /var/www/vhosts/semanticnotion.com/httpdocs/fish/allmycatch.php 온라인 7의 catch_id

Undefined index: catch_id in /var/www/vhosts/semanticnotion.com/httpdocs/fish/allmycatch.php on line 7
당신은 또한이 명령

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

를 사용하여 브라우저뿐만 아니라 터미널 내 URL 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)){ 

답변

2

&은 쉘에 의해 명령 분리 기호로 해석됩니다. 인수를 인용/이스케이프해야합니다.

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

감사합니다. – hunter