SQL bug in guestbook

Use GitHub to post bug reports and error descriptions for phpwcms. Describe your problem detailed!
Locked
rolf
Posts: 18
Joined: Sat 6. Dec 2003, 23:45
Location: Norway - Drøbak
Contact:

SQL bug in guestbook

Post 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
Rolf Dahl
bachi
Posts: 308
Joined: Fri 6. Aug 2004, 17:52
Location: Western Styria, AUSTRIA
Contact:

Post by bachi »

have you updated to the new version 27-08??

DON'T FORGET TO UPDATE THE MYSQL DATABASE ALSO!!!
rolf
Posts: 18
Joined: Sat 6. Dec 2003, 23:45
Location: Norway - Drøbak
Contact:

Post 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
Rolf Dahl
User avatar
Oliver Georgi
Site Admin
Posts: 9892
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post 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
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
rolf
Posts: 18
Joined: Sat 6. Dec 2003, 23:45
Location: Norway - Drøbak
Contact:

Post 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.
Rolf Dahl
ionrock
Posts: 279
Joined: Fri 20. Feb 2004, 17:04

Same for me

Post 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.
User avatar
Oliver Georgi
Site Admin
Posts: 9892
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post 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
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
Locked