I have php constructing a query for me to add data to a mySQL database.. an example of the query once its formed would be:
Code:
INSERT INTO `parents`
( `par_firstname` , `par_surname` , `par_primary`, `par_email` , `par_phone` , `par_acct` )
VALUES
( 'James','Bradshaw', '0', 'j.c.bradshaw@hotmail.com', '02084326358', '5e2d59ae051b6b54499c8e8bfdde2f6e' );
INSERT INTO `parents`
( `par_firstname` , `par_surname` , `par_primary`, `par_email` , `par_phone` , `par_acct` )
VALUES
('Jenny','Edmonson','1','jenny@notreal.com','0778961148','5e2d59ae051b6b54499c8e8bfdde2f6e');
INSERT INTO `child`
( `child_firstname` , `child_surname` , `child_middlename`, `child_yearkey` , `child_acct` , `child_dob` )
VALUES
('cfirstname1','csurname1','cmname1','Year 4','5e2d59ae051b6b54499c8e8bfdde2f6e','07/08/95');
INSERT INTO `child`
( `child_firstname` , `child_surname` , `child_middlename`, `child_yearkey` , `child_acct` , `child_dob` )
VALUES
('cfirstname2', 'csurname2', 'cmname2', 'Year 1','5e2d59ae051b6b54499c8e8bfdde2f6e','09/01/99');
That query works when I take it and run it on the server but when run with mysql_query I get this syntax error:
Code:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; INSERT INTO `parents` ( `par_firstname` , `par_surname` , ' at line 10
The frustrating thing being that the sql is constructed using loops and its hitting a syntax error on the second parent so the syntax has to be identical to the first one! grrr!
Any help would be greatly appreciated!
-tom