Page 1 of 1

SQL bug in guestbook

Posted: Sat 28. Aug 2004, 21:25
by rolf
Inserting new record i guestbook failed in my site, a little debugging
ended up with the following fix:

The SQL query for INSERT end with a semicolon, in cnt18.article.inc.php

This is not allowed for 'mysql_query' .

BTW, the frontend_init/sample.php generate output that make error after inserting a guestbook entry when using flooding cookie.

Rolf

Posted: Sun 29. Aug 2004, 09:41
by bachi
have you updated to the new version 27-08??

DON'T FORGET TO UPDATE THE MYSQL DATABASE ALSO!!!

Posted: Sun 29. Aug 2004, 10:31
by rolf
Yes, and after removing the semicolon in the SQL string the insert work nice.
Maybe this is depend on php/mysql version?

My web server is running PHP 4.3.1, and
the database server running mySQL 3.23.55.


Rolf

Posted: Mon 30. Aug 2004, 23:31
by Oliver Georgi
can you send or show me a sample?

I have never heard that ending sql query with a semicolon is nor allowed.

Oliver

Posted: Tue 31. Aug 2004, 01:05
by rolf
Oliver Georgi wrote:can you send or show me a sample?

I have never heard that ending sql query with a semicolon is nor allowed.

Oliver
Take a look here:

http://no.php.net/manual/en/function.mysql-query.php

It's strange that the 22/6 version did not give any problem with
the ending semicolon.

Same for me

Posted: Tue 31. Aug 2004, 02:00
by ionrock
I upgraded to 22/8 and I am getting errors on some of the sql as well. Some things like uploading a file works and editing an article works, but adding a structure_level or new article doesn't work.

Posted: Tue 31. Aug 2004, 08:26
by Oliver Georgi
These are neccessary sql upgrades:

Code: Select all

ALTER TABLE `phpwcms_guestbook` ADD `guestbook_show` INT( 1 ) NOT NULL ;
ALTER TABLE `phpwcms_guestbook` CHANGE `guestbook_url` `guestbook_url` TEXT NOT NULL ;
ALTER TABLE `phpwcms_guestbook` CHANGE `guestbook_email` `guestbook_email` TEXT NOT NULL ;
ALTER TABLE `phpwcms_guestbook` CHANGE `guestbook_name` `guestbook_name` TEXT NOT NULL ;
ALTER TABLE `phpwcms_guestbook` ADD `guestbook_ip` VARCHAR( 20 ) NOT NULL ;
ALTER TABLE `phpwcms_guestbook` ADD `guestbook_useragent` VARCHAR( 50 ) NOT NULL ;
ALTER TABLE `phpwcms_articlecat` ADD `acat_order` INT( 2 ) NOT NULL ;
ALTER TABLE `phpwcms_article` ADD `article_created` VARCHAR( 14 ) NOT NULL ;
UPDATE `phpwcms_article` SET `article_created` = UNIX_TIMESTAMP( `article_tstamp` ) WHERE `article_created` = '';
Check that you just have not upgraded files only - but also upgraded your db too.

Check table names and see the connection with your error messages for: guestbook, structure and articles.

And there is no information about ending semicolons in SQL queries. This is correct!

Oliver