PDA

View Full Version : sql issue.


Checkmate
11-02-2009, 02:21 PM
When I run the prepackaged cms.sql file , I get the following error:

ERROR 1064 at line 2: 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 'CURRENT_TIMESTAMP,
PRIMARY KEY (`HistoryID`)
)' at line 7

Any help would be appreciated, thanks!

Eric Mittman
11-02-2009, 04:32 PM
What is the version of MySQL that you are working with? If the code does not like the default value then the version could be an issue. Please post back with this info so we can look into this issue more.

Checkmate
11-02-2009, 11:37 PM
What is the version of MySQL that you are working with? If the code does not like the default value then the version could be an issue. Please post back with this info so we can look into this issue more.

I cannot seem to get the version of SQL from my customer's host. :(

Is there an SQL query to retrieve that information?

Checkmate
11-03-2009, 02:42 PM
According to phpinfo(), my customer's host has a client api version of 4.0.27?

Eric Mittman
11-04-2009, 04:12 PM
I have done some looking around and cannot determine why you are getting this error when attempting to load the sql file.

One potential work around would be to use the function call version of this default value, it would look like this in the sql:

`HistoryDate` timestamp NOT NULL default CURRENT_TIMESTAMP(),

If this gives you the same error you should just remove the default clause here, then after the table is created you can go back after the fact and update the columns default value to be the current_timestamp. Please give this a try and let me know how it works for you.

Checkmate
11-05-2009, 10:10 AM
Still gives this:

ERROR 1064 at line 2: 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 'CURRENT_TIMESTAMP(),
PRIMARY KEY (`HistoryID`)
)' at line 7

Eric Mittman
11-05-2009, 05:02 PM
You should just remove the default clause here, then after the table is created you can go back after the fact and update the columns default value to be the current_timestamp.

The part you need to remove is this:
default CURRENT_TIMESTAMP()

Please give this a try and let me know how it works for you.

Checkmate
11-09-2009, 12:23 PM
That did it!

Although without myphpadmin I'm not sure where/how to add the value to the column after the fact. Will the software work fine without this? It appears to be working at the present without it, but I also have not pushed it in depth.

Eric Mittman
11-10-2009, 11:25 AM
It is a fairly important part for retaining the versions of the pages you are creating. Without this timestamp in this field you will have trouble checking the history of a page and reverting back to it. Does your GUI tool allow you to edit the table like this? If you are using phpmyadmin you should be able to alter the table by adding in the default value for this column. The version of MySQL that you are using may be part of the problem but I was not able to confirm this in my searching.

Checkmate
11-11-2009, 01:54 PM
My server does not have myphpadmin (that's what I was attempting to say earlier) or anything of the sort. It sends me to a page on the mysql website that no longer exists to get some form of admin tool and tells me what port I can connect on, but that's as far as it goes.

However, it appears to be pulling the timestamp anyway.

I'm currently facing a different problem, now, the php echo of the content seems to be breaking the site at the line where the php echo goes. [Edit: To clarify, the site is cropped beginning at the line with the php echo WA_getblahblahblah(args); command, losing the rest of the site. It's as if the WA_getblah(args) method is failing and php times out waiting on it to fail.]

http://www.thecompletesolution.com/advisers/index.php

I set this up on another customer site (one that I host) and it appears to be working just fine, so I'm fairly stumped.

Eric Mittman
11-12-2009, 12:58 PM
I was not able to see the error when I visited the page. If you are inserting the content part onto the page you must ensure that you have the includes at the top of the page and that they are going to the correct location. Is your CMS in a subfolder? If so you will need to prefix these paths with the subfolder to ensure that they link to the pages properly.

If the pages are linked in properly and the database is accessible you should see the content on the page.

Also, for setting the default value you can use any MySQL gui tool, you can instal phpmyadmin locally, you can use the MySQL Administrator tool that you can download from MySQL.com or you use any other third party tool out there that you like. I use SQLyog myself, it allows me to admin the MySQL as well as execute queries.

Checkmate
11-12-2009, 03:24 PM
I was not able to see the error when I visited the page. If you are inserting the content part onto the page you must ensure that you have the includes at the top of the page and that they are going to the correct location. Is your CMS in a subfolder? If so you will need to prefix these paths with the subfolder to ensure that they link to the pages properly.

If the pages are linked in properly and the database is accessible you should see the content on the page.

Also, for setting the default value you can use any MySQL gui tool, you can instal phpmyadmin locally, you can use the MySQL Administrator tool that you can download from MySQL.com or you use any other third party tool out there that you like. I use SQLyog myself, it allows me to admin the MySQL as well as execute queries.

I was hoping the crash might give us some information because I am also unable to see the error and the host does not give me access to error logs. The website should be a full page, complete with </body></html> tags at the end, however, as you can see from source, at the start of my content div it simply ends.

The paths are correct, the database is accessible. (I believe this to be correct, anyway, because I can edit and create content in the admin tool.)

I will look into SQLyog and get back to you.

Eric Mittman
11-12-2009, 06:20 PM
You can try to enable the error reporting yourself by using this code at the top of your pages:


<?php
error_reporting(E_ALL);
ini_set('display_errors','on');
?>


Please give this a try and let us know the result.

Checkmate
11-13-2009, 08:33 AM
You can try to enable the error reporting yourself by using this code at the top of your pages:


<?php
error_reporting(E_ALL);
ini_set('display_errors','on');
?>


Please give this a try and let us know the result.

Fatal error: Call to undefined function: wa_getcmscontent() in /usr/shared/web/thec34/advisers/index.php on line 31

Eric Mittman
11-13-2009, 11:45 AM
Ok, this tells me that there is an issue with the include files on this page. Have you copied and pasted the include file references to the top of the page? You must ensure that they appear at the top of the page and also that the paths are correct. If you have your CMS in a sub folder on your site then you must add in this subfolder prefix to the include lines, for example if you had this in a folder called CMS then the includes would need to look like this:


<?php include "CMS/Connections/localhost.php"; ?>

<?php include "CMS/WA_CMS/WA_CMS.php"; ?>

Checkmate
11-13-2009, 01:37 PM
Ok, this tells me that there is an issue with the include files on this page. Have you copied and pasted the include file references to the top of the page? You must ensure that they appear at the top of the page and also that the paths are correct. If you have your CMS in a sub folder on your site then you must add in this subfolder prefix to the include lines, for example if you had this in a folder called CMS then the includes would need to look like this:


<?php include "CMS/Connections/localhost.php"; ?>

<?php include "CMS/WA_CMS/WA_CMS.php"; ?>


... ah hah! relative paths strike. :( My path was correct but PHP was getting to the wrong place somehow.

What I have:
/cms/(files)
/advisers/index.php

so I told it "/cms/(files)" and it was not going to the site root folder. Switched off to "../cms/(files)" and now it's working. :D Thanks!

I wonder where / was making PHP look... I hope not in the actual system root! O_O

Eric Mittman
11-13-2009, 04:21 PM
If you had the paths with a slash in front of them it would have been looking for the files starting at the root of the site, not of the system. Glad to hear that you got it sorted out.