Hello!
Here's my code snippet. The $query object is always false. I threw some debugging statements in there.
The echo statement "So, $query is not an object..." is all I ever get. I don't understand why $query isn't an object. Any ideas?PHP Code:function db_connect()
{
$handle = new mysqli('localhost', 'username', 'password', 'database_name');
if (!$handle)
{
return false;
}
return $handle;
}
$handle = db_connect();
$query = $handle->prepare("insert into publications (PublicationName, FileName, FileSize, Category, CreatedBy, DatePublished, DateCreated) values (?, ?, ?, ?, ?, ?, NOW())");
if($query)
{
$query->bind_param("ssisss", $PublicationName, $NewFileName, $FileSize, $Category, $_SESSION['auth_user'], $PublishDate);
$query->execute();
}
else
{
if (mysqli_connect_errno())
{
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
else
{
echo 'So, $query is not an object, but there is not a connection error?';
exit();
}
}







Bookmarks