โดย bankjittapol » 01/11/2019 2:54 pm
thatsawan เขียน:ตั้ง loop เเล้ว เอา ฟิลด์มา insert ทีละเเถว หรือป่าวคะ ต้องการบันทึกค่าอย่างไร
ไช่ครับ คือ loop ออกมาจะได้ แบบนี้ครับบ แต่คิดไม่ออกว่าจะใส่ ส่วนของ sql insert ยังไง แล้วจะทำให้มันตรงกับ ฟิลด์ insert นั้นๆยังไงครับ
ส่วน loop ที่ใช้ ก็ foreach ธรรมดา ครับ
โค้ด: เลือกทั้งหมด
= 0
barcode = EF582568151TH
status = 103
status_description = รับฝาก
status_date = 24/07/2562 09:04:05+07:00
location = สำเหร่
postcode = 10600
delivery_status =
delivery_description =
delivery_datetime =
receiver_name =
signature =
= 1
barcode = EF582568151TH
status = 201
status_description = อยู่ระหว่างการขนส่ง
status_date = 24/07/2562 11:02:43+07:00
location = สำเหร่
postcode = 10600
delivery_status =
delivery_description =
delivery_datetime =
receiver_name =
signature =
= 2
barcode = EF582568151TH
status = 206
status_description = ถึงที่ทำการไปรษณีย์
status_date = 24/07/2562 14:55:43+07:00
location = หลักสี่
postcode = 10210
delivery_status =
delivery_description =
delivery_datetime =
receiver_name =
signature =
= 3
barcode = EF582568151TH
status = 201
status_description = อยู่ระหว่างการขนส่ง
status_date = 24/07/2562 14:58:58+07:00
location = หลักสี่
postcode = 10210
delivery_status =
delivery_description =
delivery_datetime =
receiver_name =
signature =
= 4
barcode = EF582568151TH
status = 301
status_description = อยู่ระหว่างการนำจ่าย
status_date = 24/07/2562 15:14:22+07:00
location = สำนักงาน ปณท.
postcode = 10002
delivery_status =
delivery_description =
delivery_datetime =
receiver_name =
signature =
= 5
barcode = EF582568151TH
status = 501
status_description = นำจ่ายสำเร็จ
status_date = 24/07/2562 16:59:59+07:00
location = สำนักงาน ปณท.
postcode = 10002
delivery_status = S
delivery_description = ผู้รับได้รับสิ่งของเรียบร้อยแล้ว
delivery_datetime = 24/07/2562 16:59:59+07:00
receiver_name = รอจ่าย
signature = https://track.thailandpost.co.th/signature/QDY4MTUxYjVzMGx1VDMz/QGI1c0VGMGx1VDMx/QGI1czBsVEh1VDM0/QGI1czBsdTU4MjVUMzI=
= 6
barcode = EF582568151TH
status = 301
status_description = อยู่ระหว่างการนำจ่าย
status_date = 26/10/2562 09:50:42+07:00
location = ร้องกวาง
postcode = 54140
delivery_status =
delivery_description =
delivery_datetime =
receiver_name =
signature =
= 7
barcode = EF582568151TH
status = 501
status_description = นำจ่ายสำเร็จ
status_date = 26/10/2562 10:00:44+07:00
location = ร้องกวาง
postcode = 54140
delivery_status = S
delivery_description = ผู้รับได้รับสิ่งของเรียบร้อยแล้ว
delivery_datetime = 26/10/2562 10:00:44+07:00
receiver_name = ยุพิน/ภรรยา
signature = https://track.thailandpost.co.th/signature/QDY4MTUxYjVzMGx1VDMz/QGI1c0VGMGx1VDMx/QGI1czBsVEh1VDM0/QGI1czBsdTU4MjVUMzI=
[quote="thatsawan"]ตั้ง loop เเล้ว เอา ฟิลด์มา insert ทีละเเถว หรือป่าวคะ ต้องการบันทึกค่าอย่างไร[/quote]
ไช่ครับ คือ loop ออกมาจะได้ แบบนี้ครับบ แต่คิดไม่ออกว่าจะใส่ ส่วนของ sql insert ยังไง แล้วจะทำให้มันตรงกับ ฟิลด์ insert นั้นๆยังไงครับ
ส่วน loop ที่ใช้ ก็ foreach ธรรมดา ครับ
[code]= 0
barcode = EF582568151TH
status = 103
status_description = รับฝาก
status_date = 24/07/2562 09:04:05+07:00
location = สำเหร่
postcode = 10600
delivery_status =
delivery_description =
delivery_datetime =
receiver_name =
signature =
= 1
barcode = EF582568151TH
status = 201
status_description = อยู่ระหว่างการขนส่ง
status_date = 24/07/2562 11:02:43+07:00
location = สำเหร่
postcode = 10600
delivery_status =
delivery_description =
delivery_datetime =
receiver_name =
signature =
= 2
barcode = EF582568151TH
status = 206
status_description = ถึงที่ทำการไปรษณีย์
status_date = 24/07/2562 14:55:43+07:00
location = หลักสี่
postcode = 10210
delivery_status =
delivery_description =
delivery_datetime =
receiver_name =
signature =
= 3
barcode = EF582568151TH
status = 201
status_description = อยู่ระหว่างการขนส่ง
status_date = 24/07/2562 14:58:58+07:00
location = หลักสี่
postcode = 10210
delivery_status =
delivery_description =
delivery_datetime =
receiver_name =
signature =
= 4
barcode = EF582568151TH
status = 301
status_description = อยู่ระหว่างการนำจ่าย
status_date = 24/07/2562 15:14:22+07:00
location = สำนักงาน ปณท.
postcode = 10002
delivery_status =
delivery_description =
delivery_datetime =
receiver_name =
signature =
= 5
barcode = EF582568151TH
status = 501
status_description = นำจ่ายสำเร็จ
status_date = 24/07/2562 16:59:59+07:00
location = สำนักงาน ปณท.
postcode = 10002
delivery_status = S
delivery_description = ผู้รับได้รับสิ่งของเรียบร้อยแล้ว
delivery_datetime = 24/07/2562 16:59:59+07:00
receiver_name = รอจ่าย
signature = https://track.thailandpost.co.th/signature/QDY4MTUxYjVzMGx1VDMz/QGI1c0VGMGx1VDMx/QGI1czBsVEh1VDM0/QGI1czBsdTU4MjVUMzI=
= 6
barcode = EF582568151TH
status = 301
status_description = อยู่ระหว่างการนำจ่าย
status_date = 26/10/2562 09:50:42+07:00
location = ร้องกวาง
postcode = 54140
delivery_status =
delivery_description =
delivery_datetime =
receiver_name =
signature =
= 7
barcode = EF582568151TH
status = 501
status_description = นำจ่ายสำเร็จ
status_date = 26/10/2562 10:00:44+07:00
location = ร้องกวาง
postcode = 54140
delivery_status = S
delivery_description = ผู้รับได้รับสิ่งของเรียบร้อยแล้ว
delivery_datetime = 26/10/2562 10:00:44+07:00
receiver_name = ยุพิน/ภรรยา
signature = https://track.thailandpost.co.th/signature/QDY4MTUxYjVzMGx1VDMz/QGI1c0VGMGx1VDMx/QGI1czBsVEh1VDM0/QGI1czBsdTU4MjVUMzI=
[/code]