The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

HELP ON INSERTING MUTIPLE VALUES IN Mysql table using PHP

I have a php code for inserting records, now this code inserts more than two records at a time.
The code is below. I want the code NOT be inserting a record in case a form variable or value is empty. I have tried but I can not get it. I mean if a user did not key any value in text filed form, then submit, it should not insert the value but skip and go to another row or record that I have value. Iam asking this becuase when I submit with all form values or variables, the php code is inserting without a problem but when I submit a form with some form values or variables Iam get an errory saying ('Error, insert query failed'); .

Hi Zamzam,
I don't know whether I will help you but I will try
first of all when one of your queries is not corrent the die() is executed that is why nothing happens after that bacause die() stops the execution of the script
you can first check whether the user entered the values needed for the query and then if everything is ok execute it.
But even if there are missing values the query should pass and insert empty values maybe somethings wrong with the mysql table and the values you are trying to insert you can see what error the mysql_query raise with mysql_error()
try something like this:

Hi Elena,
If there 6 records to insert and I type 6 records in a form there are able to go with out a problem. But if there 6 records to insert and I type 4 records I receive an error.
That is where I need some help