mysqli insert_id
Posted: Thu Mar 31, 2011 2:59 pm
I'm trying to retrieve the mysqli insert_id from an INSERT database query but each time the result is 0. PLease can someone point me in the right direction as to what i'm doing wrong. Here is my query
Code: Select all
$mysqli = new mysqli(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME);
$this->execSQL("INSERT INTO itm_pic_detail(itm_pic_name, itm_pic_type, itm_pic_size) VALUES (?,?,?)", array('sss', $filename, $type, $size),true);
$mysqli->insert_id;
$message = "$filename uploaded successfully";
}
if ($this->_renamed) {
$message .= " and renamed $name";
}
$this->_messages[] = $message;
} else {
$this->_messages[] = 'Could not upload ' . $filename;
}
}
}
[ /syntax]