Reputation: 2357
I am trying to insert serialize values into ac_services
table but getting error:
syntax error, unexpected T_LNUMBER in C:\wamp\www\db-setup\steps\db-install-script.php on line 559
$insert_ac_services = "
INSERT INTO `ac_services`
( `id` , `name` , `desc` , `duration` , `unit` , `paddingtime` , `cost` , `capacity` , `availability` , `business_id` , `category_id` , `staff_id` )
VALUES
( 1, 'Default', 'this is default service.', 30, 'minute', 10, 15, 1, 'yes', 0, 0, 'a:1:{i:0;s:2:"1";}' ) ;
";
mysql_query($insert_ac_services);
I generated this php query by phpmyadmin. But not working, Any suggestion? Thanks...
Upvotes: 0
Views: 8682
Reputation: 17364
I got the same error, in my case it was a silly typo error
retun 0; //r is missing in return
Was getting the same error
Parse error: syntax error, unexpected '0' (T_LNUMBER)
Upvotes: 0
Reputation: 97631
Use a heredoc, so that you don't need to escape any quotes.
$insert_ac_services = <<<SQL
INSERT INTO `ac_services`
( `id` , `name` , `desc` , `duration` , `unit` , `paddingtime` , `cost` , `capacity` , `availability` , `business_id` , `category_id` , `staff_id` )
VALUES
( 1, 'Default', 'this is default service.', 30, 'minute', 10, 15, 1, 'yes', 0, 0, 'a:1:{i:0;s:2:"1";}' ) ;
SQL;
That way, you can paste any query in from php_my_admin without having to worry about escaping.
Upvotes: 2
Reputation: 1839
In your last field, you insert a:1:{i:0;s:2:"1";}
. "
is already open, and you close it here.
You should escape the "
.
Upvotes: 0