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

Reply via email to