skip to Main Content

I have a standard Input Box that is submitting the value directly to the database, however including a semi-colon in the string is screwing up the DB Value.

(Example 1) Text Input Value:

<input type="text" id="security_check" value="a:1:{i:0;s:10:"1234567890";}">

Database Value Result:

security_check: s:28:"a:1:{i:0;s:10:"1234567890";}";

You’ll note that it adds s:28:” before and “; after

When I wrap the value in brackets, it appears fine, but then the DB value includes brackets which doesn’t work as it needs to be exact.

(Example 2) Text Input Value:

<input type="text" id="security_check" value="[a:1:{i:0;s:10:"1234567890";}]">

Database Value Result:

security_check: [a:1:{i:0;s:10:"1234567890";}]

Is there a way I can format the input value before submit, so that it appears in the DB with the semicolon included, exactly as originally written?

2

Answers


  1. I think you have saved serialized data into database in serialize data string or serialize array counts added in front of string in database field

    Login or Signup to reply.
  2. Are you using prepared statements or building your query dynamically and executing that? You can have this type of issue if you are not using prepared statement, and as well prepared statements reduce if not eliminate the possibility of SQL injection attacks.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search