Click here to Skip to main content
11,411,263 members (64,692 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-Server PHP
Hi,
I want to validate my xml file and have to insert into sql server table whether it is valid or not and the reason if it is invalid.
I have user schemaValidate() to validate the file and libxml_get_errors(); to get the errors if it is not valid.
for example if i get errors message as follows

Error 1871 is Element 'from': This element is not expected. Expected is ( to ). on line 4

I need to insert above in reason field in my table but getting syntax error as it contains brackets (). How to solve this?
Posted 22-Mar-13 2:52am
Comments
ryanb31 at 22-Mar-13 7:56am
   
Use a stored procedure and parameters and then you should not get a syntax error. However, you haven't posted any relevant code so I don't think anyone can help you beyond that.
Prasad Khandekar at 22-Mar-13 11:39am
   
Hello Member9762654,

You don't essentially have to go down Stored proc way. PHP does supports bind parameters. Please have a look at this reference material for more details and an example (http://php.net/manual/en/mysqli-stmt.bind-param.php).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 149
1 Sascha Lefévre 110
2 OriginalGriff 103
3 Dave Kreskowiak 80
4 Maciej Los 78
0 Sergey Alexandrovich Kryukov 8,920
1 OriginalGriff 6,983
2 Maciej Los 3,430
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web01 | 2.8.150414.5 | Last Updated 22 Mar 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100