0

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...

4 Answers 4

6

You should escape the ".

'a:1:{i:0;s:2:\"1\";}' ) ;

Sign up to request clarification or add additional context in comments.

1 Comment

Some-times stacker rocks. I made it and my installer completed. Thanks so much...
2

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.

Comments

0

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 ".

Comments

0

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)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.