Is anyone familiar with what would cause an error like this:
Warning: Statement isn't valid anymore in includes\import.inc.php on
line 810

I'm using MySQL 4.1.2a, PHP 5.0.0 with Apache 2.0.50.  All tables are
InnoDB format.

The calling function is:
function insert_phone($ContactID) {
global $kTABLE_PREFIX;

foreach( $this->PhoneList as $addr ) {
        $db = DoMySQLConnect(); // connect
        $sql = "INSERT INTO {$kTABLE_PREFIX}phone (PhoneType, Phone,
Extension, ContactID) VALUES (?, ?, ?, ?)";
        if( !$stmt = $db->prepare($sql) ) { // prepare it
                printf("Error with %s:<br>%s<br>",$sql, $db->error );
        } else {
                if( !$stmt->bind_param("sssd", $addr->PhoneType,
$addr->Phone, $addr->Extension, $ContactID ) ) {
                        printf("Error (#%d): %s;<br>%s<br>",
$stmt->errno, $sql, $stmt->error );
                } else {
                        $stmt->execute(); // execute

bind_param fails and I end up with:
Error (#0): INSERT INTO ap2004phone (PhoneType, Phone, Extension,
ContactID) VALUES (?, ?, ?, ?);

insert_phone is part of a class, Phone.

import.inc.php contains class definitions for a bunch of different
objects, contacts, email addresses, addresses etc that are being
massaged from a single flat table into relational tables.  There are
around 2000 inserts performed in a single import.  At the beginning of
the import I disable all foreign key checks etc 
                .       "SET
                .       "SET
                .       "SET NAMES utf8; "
                .       "SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS,
                .       "SET
                .       "SET @OLD_SQL_MODE=@@SQL_MODE,

        $db = DoMySQLConnect();

And at the end of the import I re-enable them.

As far as I can tell, there is nothing wrong with the INSERT statement,
or the variables it is inserting.  The errors appear randomly, and for
different objects at different times.  Occasionally there are no errors,
and then other times there are hundreds.  There are no mysql errors in
the mysql error log either.

Anyone have any ideas?  I'm going crazy :(


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

Reply via email to