SQL validation!

Posted by Filip on Stack Overflow See other posts from Stack Overflow or by Filip
Published on 2010-06-05T12:42:59Z Indexed on 2010/06/05 12:52 UTC
Read the original article Hit count: 192

Filed under:
|

I am pretty new in SQL so this may be a stupid question...

I have a form in PHP which fills in few fields in my SQL table. I have this code:

$sql="INSERT INTO $tbl_name
(app_name, app_path, short_desc, full_desc)
VALUES ('$_POST[app_name]', '$_POST[app_path]',
'$_POST[short_desc]', '$_POST[full_desc]')";

But even app_name and app_path are NOT NULL columns, the query can be executed if there is no text in these fields in the form.

So, my question is:

How to stop the execution of the query if there is no text in the NOT NULL fields ?

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql