Sandeep Vellaparambil
Sandeep Vellaparambil

Reputation: 15

Store the result of var_dump in mysql

I have a form contains many text box,checkbox,radio etc.

for the posting page i used var_dump to capture result.

I need to store the result of var_dump in mysql . Is it possible?

Upvotes: 0

Views: 2018

Answers (1)

Mark Baker
Mark Baker

Reputation: 212522

It's perfectly possible, just not generally wise to do so. var_dump() is generally used as a tool for debugging, not as a data storage format; var_export() will give you the same format, but returning it as a string that can be stored rather than simply displaying it to screen.

Your problem will be trying to do something with the data subsequently, because it's a format that's not easily reversible: you'll have problems trying to parse it back to the original form variables.

You might instead want to consider using json_encode() or serialize() instead, both of which are reversible formats, making it easy to restore the original data in a form that a script can then work with again.

Upvotes: 1

Related Questions