Tags:

คือ ใส่ ข้อมูลไป ว่า

it's

ใน input textarea

ปรากฏว่า อัพเดทลง db ไม่ได้

ตอนนี้ใช้ addslashes คลุม value อยู่ ได้ it/'s

update table set field = 'it/'s' ได้มาแบบนี้ ยัดลง db ไม่ผ่าน

ควรจัดการกับ single qoute ยังไงดีครับ

Get latest news from Blognone
By: ionz
AndroidWindows
on 23 December 2015 - 13:17 #870729
  1. Escape character ไม่ใช่ /
  2. ทำความรู้จัก SQL Injection ให้ดี
  3. ฝึกเขียน Prepared statement
By: Go-Kung
iPhoneWindows PhoneAndroidBlackberry
on 23 December 2015 - 13:30 #870731

เขียนแบบนี้ให้ระวังการโดน SQL Injection

สุดท้ายแล้ว PreparedStatement คือคำตอบครับ

By: Detective
Android
on 23 December 2015 - 15:01 #870764

งงมาก เขียนแต่ mysql มาตลอด เจอ oracle ปรับจาก mysql > oracle ไม่ค่อยจะถูกเลย

By: nat3738
ContributorAndroidRed HatUbuntu
on 23 December 2015 - 15:31 #870777 Reply to:870764

ตามข้างบนเลยครับ ใช้ PreparedStatement

By: tekkasit
ContributorAndroidWindowsIn Love
on 24 December 2015 - 12:29 #870958
tekkasit's picture

แนะนำว่าใช้ PrepareStatement เถอะครับ

ถึงคุณจะ escape ได้ แต่ถ้าเค้ารู้ทาง โดนสวนมานี่หลุดทั้งกระบิเลยนะครับ

By: Detective
Android
on 18 January 2016 - 17:46 #876257

ขอบคุณมากครับ