View previous topic :: View next topic |
Author |
Message |
duoitrun
Joined: 18 May 2004 Posts: 26
|
Posted: Tue May 18, 2004 12:31 am Post subject: Error: Sql syntax |
|
|
I received this error after running b2install.php:
Parse error: parse error in /home/username/public_html/b2config.php on line 39
Now creating the necessary tables in the database...
doh, can't create the table "" in the database.
query:
CREATE TABLE ( ID int( 10 ) unsigned NOT NULL auto_increment, post_author int( 4 ) DEFAULT '0' NOT NULL, post_date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, post_content text NOT NULL, post_title text NOT NULL, post_category int( 4 ) DEFAULT '0' NOT NULL, post_karma int( 11 ) DEFAULT '0' NOT NULL, PRIMARY KEY ( ID ), UNIQUE ID ( ID ) )
error:
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 '( ID int( 10 ) unsigned NOT NULL auto_increment, post_author in
Does anybody have the same prob?
I have no idea how to fix that. Could anybody help?????? |
|
Back to top |
|
 |
duoitrun
Joined: 18 May 2004 Posts: 26
|
Posted: Tue May 18, 2004 12:33 am Post subject: |
|
|
MySQL Version: 4.0.18-standard |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 178
|
Posted: Tue May 18, 2004 5:46 pm Post subject: |
|
|
That error comes from the lines in b2install.php
Code: | $query = "CREATE TABLE $tableposts ( ID int(10) unsigned NOT NULL auto_increment, post_author int(4) DEFAULT '0' NOT NULL, post_date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, post_content text NOT NULL, post_title text NOT NULL, post_category int(4) DEFAULT '0' NOT NULL, post_karma int(11) DEFAULT '0' NOT NULL, PRIMARY KEY (ID), UNIQUE ID (ID) )";
$q = mysql_query($query) or mysql_doh("doh, can't create the table \"$tableposts\" in the database.", $query, mysql_error()); |
which suggests it can't find the variable $tableposts.
Look in b2config.php. Do you have the line Code: | $tableposts = 'b2posts'; | there? In fact you should have:
Code: | # database tables' names (change them if you want to have multiple b2's in a single database)
$tableposts = 'b2posts';
$tableusers = 'b2users';
$tablesettings = 'b2settings';
$tablecategories = 'b2categories';
$tablecomments = 'b2comments'; |
|
|
Back to top |
|
 |
duoitrun
Joined: 18 May 2004 Posts: 26
|
Posted: Tue May 18, 2004 8:23 pm Post subject: |
|
|
That's what I have |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 178
|
Posted: Tue May 18, 2004 8:53 pm Post subject: |
|
|
I should have read the error message more closely where it said:
Parse error: parse error in /home/username/public_html/b2config.php on line 39
The error on this line stopped the program reading the rest of b2config.php causing the database error
Lines 38 & 39 are
Did you leave out the single quotes or the ; at the end of the second line above? |
|
Back to top |
|
 |
duoitrun
Joined: 18 May 2004 Posts: 26
|
Posted: Tue May 18, 2004 9:22 pm Post subject: |
|
|
Nuh uh, I have both the ' and the " quote.
Now I receive this:
Parse error: parse error in /home/sodapop/public_html/b2config.php on line 39
Now creating the necessary tables in the database...
doh, can't create the table "" in the database.
query:
CREATE TABLE sodapop_b2posts( ID int( 10 ) unsigned NOT NULL auto_increment, post_author int( 4 ) DEFAULT '0' NOT NULL, post_date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, post_content text NOT NULL, post_title text NOT NULL, post_category int( 4 ) DEFAULT '0' NOT NULL, post_karma int( 11 ) DEFAULT '0' NOT NULL, PRIMARY KEY ( ID ), UNIQUE ID ( ID ) )
error:
Table 'sodapop_b2posts' already exists
This's a mess. I'm confused. |
|
Back to top |
|
 |
duoitrun
Joined: 18 May 2004 Posts: 26
|
Posted: Tue May 18, 2004 9:25 pm Post subject: |
|
|
I meant I have both the ' and the ; |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 178
|
Posted: Tue May 18, 2004 9:27 pm Post subject: |
|
|
Code: | Table 'sodapop_b2posts' already exists |
Hey that's good news! It means it has worked out a name. Let's find out what the error is on line 39. Can you say what you have there, but disguising if you wish your email address? |
|
Back to top |
|
 |
duoitrun
Joined: 18 May 2004 Posts: 26
|
Posted: Tue May 18, 2004 9:38 pm Post subject: |
|
|
I have :
# your email (obvious uh ?)
$admin_email = '[email protected]';
[/b] |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 178
|
Posted: Tue May 18, 2004 9:53 pm Post subject: |
|
|
There's absolutely nothing wrong there. Can you check 2 things:
1. Is $admin_email = '[email protected]';
really line 39 - if not can you tell me what line 39 is?
2. On previous lines, have you got either # at the beginning of a line or ; at the end, with the right quotes?
If you'd prefer, copy the first 40 odd lines here, but replacing anything you don't want public by xxxxxxx eg
Code: | $pathserver = 'xxxxxxxxxx'; |
|
|
Back to top |
|
 |
duoitrun
Joined: 18 May 2004 Posts: 26
|
Posted: Tue May 18, 2004 9:59 pm Post subject: |
|
|
<?php
/* *
* b2's config file *
* */
# Reminder: everything that starts with #, /* or // is a comment
/* Start editing */
# $siteurl is your blog's URL: for example, 'http://mydomain.com' (no trailing slash !)
# $blogfilename is the name of the default file for your blog
# $blogname is the name of your blog
$siteurl = 'http://xxxxx.xxx';
$blogfilename = 'index.php';
$blogname = '|::.broken.: ';
$blogdescription = 'News & Updates';
# fill these only if you have a Cafelog ID,
# this enables your blog to be in the Recently Updated b2 blogs list.
# to obtain this ID, e-mail [email protected] with these details:
# name of the weblog, weblog's URL, your e-mail address, and a password
# in the future, the password will allow you to change these details online
$cafelogID = '';
$use_cafelogping = 1; # set this to 1 if you do have a Cafelog ID
# $pathserver is where you have uploaded b2: for example, 'http://mydomain.com' (no ending slash !)
# by default b2 is set to run in the folder your blog resides, same as $siteurl
$pathserver = 'http://xxxxxxxx.xxx';
# your email (obvious uh ?)
$admin_email = '[email protected]';
I don't know if I should count those blank spaces. |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 178
|
Posted: Tue May 18, 2004 10:10 pm Post subject: |
|
|
There's absolutely nothing wrong in those lines, so maybe you are correct and it is counting lines differently. Can you post the next lines up to post preview function? It is vital that you xxx out the details in:
Code: | $dbname = 'xxx'; // the name of the database
$dbhost = 'localhost'; // 99% chances you won't need to change this value
$dbusername = 'xxxx'; // your MySQL username
$dbpassword = 'xxxx'; // ...and password |
I am sure there is a missing ; ' $ or similar somewhere |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 178
|
Posted: Tue May 18, 2004 10:53 pm Post subject: |
|
|
Another idea if the parse error can't be traced - sometimes the cause of the error can be hard to see especially if it's something small like a quote. Start again with your original untouched version of b2config.php and carefully make the changes for your setup and try again.
When running b2install.php you can ignore anything that says something like:
Code: | query:
blah blah
error:
Table 'sodapop_b2posts' already exists |
as that just means the table doesn't need creating all over again. |
|
Back to top |
|
 |
duoitrun
Joined: 18 May 2004 Posts: 26
|
Posted: Wed May 19, 2004 12:31 am Post subject: |
|
|
I checked b2config.php and I am sure there're any missing quotes or something like that.
What about the error that says
"Table 'sodapop_b2posts' already exists"? What do I have to do to fix that?? I am confused again.
|
|
Back to top |
|
 |
duoitrun
Joined: 18 May 2004 Posts: 26
|
Posted: Wed May 19, 2004 12:55 am Post subject: |
|
|
I have worked it all out until ...
Parse error: parse error in /home/sodapop/public_html/b2config.php on line 39
Now creating the necessary tables in the database...
doh, can't drop the table "" in the database.
|
|
Back to top |
|
 |
|