||09-20-2013 10:55 PM
cant find my mysql line error
Hi im looking for my error but i cant find it.
mysql 5.5.32 version
this is the message im getting
'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 `mca_admins` (`id` , `username` , `password` , `email` , `super` , `' at line 13' during the following query:
INSERT INTO `mca_admins` (`id` , `username` , `password` , `email` , `super` , `date` , `time` , `primary` ) VALUES ('1', 'admin', 'a062322cd3a14f8f7a2e046a28685cc1', 'email@example.com', '1', NOW(), NOW(), '1')
and this is the query i produce.. and it does work if i copy and paste it to the myPHPAdmin sql nothing wrong with it there, so i cant find the hangup!!
CREATE TABLE IF NOT EXISTS `mca_admins` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`password` varchar(32) NOT NULL,
`email` varchar(100) NOT NULL,
`super` enum('0','1') NOT NULL DEFAULT '0',
`date` date NOT NULL DEFAULT '0000-00-00',
`time` time NOT NULL DEFAULT '00:00:00',
`primary` enum('0','1') NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0;
INSERT INTO `mca_admins` (`id` , `username` , `password` , `email` , `super` , `date` , `time` , `primary` )
VALUES ('1', 'admin', 'a062322cd3a14f8f7a2e046a28685cc1', 'firstname.lastname@example.org', '1', NOW(), NOW(), '1');
i also tried removing the tilde around the db name and no difference INSERT INTO mca_admins (`id` ,
||09-21-2013 06:15 AM
What happens if you do that as two separate queries from php? The fact it says error is on line 13 tells me you are doing it in one query and maybe php library is the problem.
||09-21-2013 08:36 AM
Nice call on that one... :)
Since i am exploding on ; i did figure out that i had to readd the ; on the end of the statement inside my statement loop before i sent it off to the server.
But doing this once statement at a time was the trick. Which i find strange that it does not like the two statements together. But it is at least creating the tables now.
Thanks Old Pedant EXCELLENT CALL!
||09-21-2013 08:57 PM
Well, I know that mysql_query is *NOT* capable of more than one MySQL query at a time. I don't know about mysqli library or PDO.
|All times are GMT +1. The time now is 02:11 PM.
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.