2015-03-02 42 views
-2

當我嘗試運行此查詢注意:未定義的變量:led_nem在C:上線71

$SQL = " SELECT * FROM info WHERE username = '$led_nem'"; 
$result = mysql_query($SQL); 
while ($db_field = mysql_fetch_assoc($result)) { 
     $tsk = $db_field['group_task']; 
} 

我得到這個錯誤\ XAMPP \ htdocs中\網絡\在線任務管理系統\ task_mem.php

注意:未定義的變量:led_nem在C:\ XAMPP \ htdocs中\網絡\在線 上線任務管理系統\ task_mem.php如果變量$led_nem存在71

+0

一旦檢查'$ led_nem' ...打印一次,並檢查其是否具有價值或不.. – phpfresher 2015-03-02 11:55:14

回答

0

測試使用前:

if (isset($led_nem)) { 
    $SQL = " SELECT * FROM info WHERE username = '$led_nem'"; 
    $result = mysql_query($SQL); 
    while ($db_field = mysql_fetch_assoc($result)) { 
     $tsk = $db_field['group_task']; 
    } 
} 
0

使用此

if (isset($led_nem)) { 
$SQL = " SELECT * FROM info WHERE username = '".$led_nem."'"; 
$result = mysql_query($SQL); 
while ($db_field = mysql_fetch_assoc($result)) { 
     $tsk = $db_field['group_task']; 
} 
} 
相關問題