Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 08:50 am EDT

Geeklog Forums

PHP 5 with fresh Geeklog 14 install - SQL Error


Status: offline

ronack

Forum User
Full Member
Registered: 05/27/03
Posts: 612
This comes from another thread but I'm sure that PHP 5 must either be missing a setting or has something set that PHP 4.x.x didn't have. I just installed a fresh install of GL 1.4 tried to submit a storie and received

An SQL error has occurred. Please see error.log for details.

Checking the GL 1.4 error log I find.
Text Formatted Code

2/23/05 15:45:24 - 1366: Incorrect integer value: '' for column 'statuscode' at row 1. SQL in question: REPLACE INTO gl_stories (sid,uid,tid,title,introtext,bodytext,hits,date,comments,related,featured,commentcode,trackbackcode,statuscode,expire,postmode,frontpage,draft_flag,numemails,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon,show_topic_icon,in_transit) VALUES ('20051223154507351',2,'GeekLog','test','test','',0,FROM_UNIXTIME(1135370707),'0','',0,'0','-1','',FROM_UNIXTIME(943981207),'plaintext','1',0,0,2,3,3,2,2,2,1,1)

 


This is the site here

Am I missing a setting in PHP for this to work properly or what?
 Quote

Status: offline

ronack

Forum User
Full Member
Registered: 05/27/03
Posts: 612
More information, the problem is only admin. Anonymous and Regular users seem to be working ok.

 Quote

Status: offline

ronack

Forum User
Full Member
Registered: 05/27/03
Posts: 612
Dirk, could this be a problem. In admin/story.php it says this

Text Formatted Code
* @param    string      $statuscode     Status of the story


 

Yet in MySQL statuscode is shown as TinyINT
 Quote

Status: offline

ronack

Forum User
Full Member
Registered: 05/27/03
Posts: 612
Dirk, I don't know if this is a good fix or not but at least I can post admin/submit.php and admin/plugins/staticpages.php. for admin/submit.php I change the statuscode field in mysql to Varchar and gave it a value of 20.

For admin/plugins/staticpage.php I added this on line 475
Text Formatted Code
$sp_nf = 0;
 

I'm sure it's not right but at least it's working. Please let me know if you have some other solution.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
I think part of the confusion here comes from how checkboxes are handled:

In the database, we store the status of a checkbox (e.g. sp_inblock, i.e. wrap static page in a block) as TINYINTs with a value of 0 (unchecked) or 1 (checked). The POST request for the HTML form, however, returns the string "on" for a checked checkbox.

So Geeklog has to check if sp_inblock equals "on" and if it does, store that as "1" in the database. Looks like not all checkboxes in the static pages editor have been handled properly, though. I have now fixed that and would like to ask you to please try it again with the current CVS version, as I still can't reproduce the SQL error.

In the Admin's story editor, some of the integer values (from dropdowns such as "statuscode") were treated as strings which could have caused them ending up being stored as empty strings instead of zeros. Again, this should be fixed in CVS now. Please try that out, too.

bye, Dirk
 Quote

Status: offline

congleal

Forum User
Full Member
Registered: 11/08/04
Posts: 179
I having a similar problem and updating my "MySQL", I kind of understand but not completely sure how to correct my error.

12/31/2006 04:33:03 PM - 1366: Incorrect integer value: '' for column 'statuscode' at row 1. SQL in question: REPLACE INTO gl_stories (sid,uid,tid,title,introtext,bodytext,hits,date,comments,related,featured,commentcode,statuscode,expire,postmode,frontpage,draft_flag,numemails,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon,show_topic_icon) VALUES ('20060425181314943',4,

Any help would be greatly appreciated! Happy New Year!

Rgds,

Lee
 Quote

Status: offline

ronack

Forum User
Full Member
Registered: 05/27/03
Posts: 612
Quote by: Dirk

I think part of the confusion here comes from how checkboxes are handled:<br /><br />In the database, we store the status of a checkbox (e.g. sp_inblock, i.e. wrap static page in a block) as TINYINTs with a value of 0 (unchecked) or 1 (checked). The POST request for the HTML form, however, returns the string "on" for a checked checkbox.<br /><br />So Geeklog has to check if sp_inblock equals "on" and if it does, store that as "1" in the database. Looks like not all checkboxes in the static pages editor have been handled properly, though. I have now fixed that and would like to ask you to please try it again with the current CVS version, as I still can't reproduce the SQL error.<br /><br />In the Admin's story editor, some of the integer values (from dropdowns such as "statuscode"Wink were treated as strings which could have caused them ending up being stored as empty strings instead of zeros. Again, this should be fixed in CVS now. Please try that out, too.<br /><br />bye, Dirk

Wish I could Dirk but I no longer have the server with PHP 5 my other server has PHP 4.4.4 and everything seems to work okay.
 Quote

Status: offline

congleal

Forum User
Full Member
Registered: 11/08/04
Posts: 179
Sorry for my ignorance... but what am I to do to correct this error?

Rgds,

Lee
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
First of all, let me point out that this thread is already a year old ...

Which Geeklog, PHP and MySQL versions are we talking about? Geeklog 1.4.0 and later should work just fine "out of the box" with the most recent versions of both PHP and MySQL. The only exception is the list of members of a group in 1.4.0, that throws an SQL error on MySQL 5 (fixed in Geeklog 1.4.1).

bye, Dirk
 Quote

All times are EDT. The time is now 08:50 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content