Author Topic: Database & script problems with auto increment fields  (Read 3164 times)

vrinfo

  • Posts: 14
    • View Profile
Database & script problems with auto increment fields
« on: January 15, 2008, 06:00:00 am »
Having tried to install ListMailPro on Windows 2003 Server and Mysql 5.0.37 ( I had to work around the install problems ) I am finding that the scripts do not work. There seem to be problems with the auto increment fields ( seen in the install and various places such as trying to send an email ). I have therefore reverted to trying to get a clean working install with viable table options.

Are there particular options I need to set on the mysql or php installations to make things work ? I am using PHP 5.2.1

Thanks

Notes :
When operating the install script - editconf.php it fails when trying the $cmd set on line 1363 to "INSERT INTO $ktable VALUES(''.'ex1','Example 1','ftp.... )

when executing this command from the mysql browser it does the insert but gives error number 1366 - Incorrect integer value: for column id at row 1.

My working assumption is that this behaviour varies by version of mysql / php etc.

vrinfo

  • Posts: 14
    • View Profile
Auto increment problem
« Reply #1 on: January 15, 2008, 07:23:24 am »
Found the answer...

The issue affects certain versions of mysql running under Windows. The fix is to alter the php code from INSERT INTO... VALUES('',...
to INSERT INTO... VALUES(NULL,....

i.e. remove the hard blank with quotes and replace with a NULL for the auto increment field. This then results in successful inserts from ListMailPro...

Wish I hadn't had to find it out the hard way though....

Cheers

 :D

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Database & script problems with auto increment fields
« Reply #2 on: January 15, 2008, 06:59:28 pm »
Greetings,

I was just about to suggest that!

There are, unfortunately, many other places in the ListMail code where the auto_increment is expected to work with '' instead of NULL.

A global search of all files for "insert into" should find all of the statements to modify.  Basically the first values field should be changed from '' (two apostrophes) to NULL

If you need help applying this fix you can submit your info here.

I have made a note for future updates.

Regards
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

vrinfo

  • Posts: 14
    • View Profile
Also require fixes to 'null'
« Reply #3 on: January 16, 2008, 12:34:10 am »
I also found later in the testing cycle that I needed to replace instances of INSERT INTO ...with 'null' with NULL ( for instance in editfups.php ) in order to get the insertion working correctly....

Cheers