Reputation: 31
i am not familiar with this kind of error Undefined error offset: 1
. how im i going to fix this error?
here is my code together with my query:
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];
thank you in advance
Upvotes: 0
Views: 18667
Reputation: 459
I assume the following line is causing the error:
$doc_numn2 = $value[1];
You need to check there is an array item at that index before trying to access it:
$doc_numn2 = isset($value[1]) ? $value[1] : null;
It's likely that a certain row you are processing doesn't have a document number value that is comma separated.
Hope this helps.
Upvotes: 2