0
我不熟悉這種錯誤Undefined error offset: 1
。我該如何解決這個錯誤?如何解決未定義的偏移量:1
這裏是我的代碼連同我的查詢:
SELECT document_crew_id,doc_number,full_name,id,doc_type,date_issue,date_expiry,place_of_issue,crew_status,
GROUP_CONCAT(doc_number) as document_number,
GROUP_CONCAT(date_issue) as date_issued,
GROUP_CONCAT(date_expiry) as date_expired,
GROUP_CONCAT(place_of_issue) as place_issueda
from crew_documents_table join info
on crew_documents_table.document_crew_id = info.id where doc_type = '1' or doc_type = '2' and crew_status = 'LINEUP PENDING' group by full_name
$value = $row1['document_number'];
$value = explode(",", $value);
$doc_numn2 = $value[1];
預先感謝您
好吧,顯然你的$值沒有逗號,所以$ doc_numn2只有一個字段,索引爲0.如何防止它?在你訪問它之前檢查你的數據是否存在,例如用'isset()' –
我應該在哪裏放置逗號? –
[PHP:「Notice:Undefined variable」和「Notice:Undefined index」]的可能重複(http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index) – HPierce