PHP / MySql未定义索引:id从MySql表中检索数据时

I'm trying to retrieve some data from the MySql table. But when I run the query, It showing Notice : Undefined index: id. But when I run the same query in SQLyog it is showing the correct result. Without any error.

Query :

SELECT id,temp_name,added,updated FROM `projtemp` WHERE `user_id`='0000000001' 

Out from SQLyog :

enter image description here

Error From Firebug Console :

<b>Notice</b>:  Undefined index: id in <b>C:\xampp\htdocs\xxx\yyy\zzz\aaa.php</b> on line <b>61</b><br />

Php Code which I executed :

try {
        $paginate = new pagination($page, "SELECT id,temp_name,added,updated FROM `projtemp` WHERE `user_id`='$uid'", $options);
    } catch (paginationException $e) {
        echo $e;
        exit();
    }

Update :

       if ($paginate->success == true) {
        while ($row = $result->fetch_assoc()) {
            $temp=array();
            $temp['id']=$row['id'];   // In this line I'm Getting Error Line-61
           $temp['tname'] = $row['temp_name'];
            $temp['added'] = $row['added'];
            if ($row['updated'] == '') {
                $temp['updated'] = 'Never';
            } else {
                $temp['updated'] = $row['updated'];
            }
            $data['data']=$temp;
        }

Please any one help me to solve this issue....

Try this, you don't need enclose with '' for integer field

$paginate = new pagination($page, "SELECT id,temp_name,added,updated FROM `projtemp` WHERE `user_id`=$uid", $options);

The error you're getting is not about your SQL query. It's about array processing. I assume you're using ID to step through an array later in your PHP code? Look there for the error.

In my DB worked this query:

"SELECT `id`, `temp_name`, `added`, `updated` FROM `projtemp` WHERE `user_id`=$uid"

or

"SELECT * FROM `projtemp` WHERE `user_id`=$uid"

but I not see in your table user_id

in your function fetch_assoc() from where you are retrieving data, Fetch a result row as an associative array, a numeric array, or both. in your case, you should write

if ($row = mysql_fetch_array ( $result, MYSQL_BOTH )) {
 $id=$row[0];
}

as your id in your table is at the 0th location. Here you can read in details.