Problem after migration of script from Fedora Core to RHEL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

This has me confused. Have just moved servers from FC4 box to RHEL box.
Basically all the settings seem to be the same. PHP5.0.4, MySQL 5.0.20

A script I use to insert text into a MySQL database now fails on the RHEL
box with the following error:

exception:
Exception Object
(
    [message:protected] => Duplicate entry '1899787-174' for key 1
    [string:private] =>
    [code:protected] => 0
    [file:protected] 
=> /var/www/virtual/tannerritchie.com/webroot/htdocs/sources.tannerritchie.com/insert.php
    [line:protected] => 90
    [trace:private] => Array
        (
            [0] => Array
                (
                    [file] 
=> /var/www/virtual/tannerritchie.com/webroot/htdocs/sources.tannerritchie.com/insert.php
                    [line] => 90
                    [function] => unknown
                )

        )
)

So it is telling that the script is trying to insert duplicate entries. The
exact same script works fine on the old box without entering duplicate
entries.

Here is the relevant section of the PHP ...

/*gets word_id number from 'words'table*/
$word_id = mysql_insert_id($conn); 
                                
/*
* inserts association between word and file. Set assoc field 'file_id' to
* integer returned by my_sql_insert_id
*/
$insertq = "INSERT INTO assoc (count, word_id, file_id) VALUES (" .
$word_count . "," . $word_id . "," . $file_id . ")";
$res = mysql_query($insertq, $conn);
if (!$res) {
        throw new Exception(mysql_error($conn));
        }

Any suggestions very gratefully accepted.

BMA

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux