T_STRING Error INSERTING data into MySQL

Getting a parse error: Unexpected T_STRING but can't see where the

Page 1 of 1

3 Replies - 1665 Views - Last Post: 09 April 2008 - 11:26 AM Rate Topic: -----

#1 douffle  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 29-March 08

T_STRING Error INSERTING data into MySQL

Posted 09 April 2008 - 08:39 AM

I'm just learning PHP and MySQL. I am trying to set up some tables in a database with PHP and MySQL and I am getting a parse error.

Parse error: syntax error, unexpected T_STRING in /home/mysite/www/myscript/install.php on line 133

I can't see where the error is, but that is likely because I am new to all of this.

Here is some of the code:

// Table structure for table 't_config'

mysql_query("CREATE TABLE mytut IF NOT EXISTS t_config (
  param varchar(50) NOT NULL DEFAULT '' ,
  value text ,
  PRIMARY KEY (param),
  UNIQUE KEY param (param)
)");

// The first INSERT is line 133

mysql_query("INSERT INTO t_config VALUES("automatic_approval","no")");
mysql_query("INSERT INTO t_config VALUES("contact_email","www.mysite.com")");
mysql_query("INSERT INTO t_config VALUES("copyright_message","Copyright (c) mysite, 2008.")");
mysql_query("INSERT INTO t_config VALUES("from_email","me@mysite.com")");




Can anyone steer me in the right direction here?

Thanks

This post has been edited by douffle: 09 April 2008 - 08:41 AM


Is This A Good Question/Topic? 0
  • +

Replies To: T_STRING Error INSERTING data into MySQL

#2 girasquid  Icon User is offline

  • Barbarbar
  • member icon

Reputation: 108
  • View blog
  • Posts: 1,825
  • Joined: 03-October 06

Re: T_STRING Error INSERTING data into MySQL

Posted 09 April 2008 - 08:57 AM

This is not the code where you are having the problem, I don't think - is it line 133?

Take a look at line 133 and look for too many(or too few) quotes.
Was This Post Helpful? 0
  • +
  • -

#3 MitkOK  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 32
  • View blog
  • Posts: 403
  • Joined: 09-August 07

Re: T_STRING Error INSERTING data into MySQL

Posted 09 April 2008 - 09:11 AM

The quotes are your problem.
Was This Post Helpful? 0
  • +
  • -

#4 douffle  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 29-March 08

Re: T_STRING Error INSERTING data into MySQL

Posted 09 April 2008 - 11:26 AM

View PostMitkOK, on 9 Apr, 2008 - 09:11 AM, said:

The quotes are your problem.



Thanks.

I changed the inner quotes to single quotes and it works fine now.

mysql_query("INSERT INTO t_config VALUES('automatic_approval','no')")or die(mysql_error());



Thanks again.

This post has been edited by douffle: 09 April 2008 - 11:27 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1