ryanh_106 Posted August 16, 2006 Share Posted August 16, 2006 Hi, sorry if this is a noddy question but I am pretty new to reg expsI want to check that an SQL statement is of the formINSERT INTO table (cols) VALUES (values)and notINSERT INTO table (cols) VALUES (values), (morevalues), (moreagain)i.e. Only one set of values is being used (nobody has injected an extra row in there)but when I imagine how the regexp would look i can only imagine something like (.*) which could still be "(x), (y), (z)"How does this work?CheersRyan Quote Link to comment https://forums.phpfreaks.com/topic/17778-validating-sql/ Share on other sites More sharing options...
ToonMariner Posted August 17, 2006 Share Posted August 17, 2006 you should not be allowing users to inject mysql!any data you process from a form should be checked to see if they are trying to inject - using mysql_escape_string or mysql_escape_real_string are what you need. Quote Link to comment https://forums.phpfreaks.com/topic/17778-validating-sql/#findComment-76130 Share on other sites More sharing options...
ryanh_106 Posted August 17, 2006 Author Share Posted August 17, 2006 :-[ ???Where did I say I wanted to let them inject SQL??? That would just be stupid, I am trying to check they ARENT injecting.I was interested to know how this could be checked using reg exps (aswell as the mysql functions) Quote Link to comment https://forums.phpfreaks.com/topic/17778-validating-sql/#findComment-76153 Share on other sites More sharing options...
ToonMariner Posted August 17, 2006 Share Posted August 17, 2006 Where did I say you were wanting them to insetr mysql? I sadi you shoudl not let them - by that I mean your code shoudl be such that youare protected against injection....So I will accept your apology before you offer it ;)There is no point in reasearching what regex you will need to perform thsi task - it will be less efficient and less effective than the already availbe, built for purpose functions. Quote Link to comment https://forums.phpfreaks.com/topic/17778-validating-sql/#findComment-76243 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.