473,386 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Prepared Statment seems to run but doesn't affect database

I have written a function that runs a prepared statement and it seems
to run just fine but when I check to see the affected rows nothing is
affected. Can someone take a look at my code and tell me if they notice
anything wrong outright.

[CODE BLOCK for config.php]
function QueryDB_mysqli($query, $typeStr, $varStr){
$db_connection = new mysqli(DB_HOST, DB_USER, DB_PASSWORD,DB_DATABASE);
$statement = $db_connection->prepare($query);
$statement->bind_param($typeStr, $varStr);
$statement->execute();
$statement->close();
exit();
}

[END CODE BLOCK]

[CODE BLOCK for mgb.php]
$varStr = $userID . "," . $end_book . "," . $start_book . "," . $title
.. "," . $notes . "," . $start_date . "," . $end_date . "," . $skip_days
.. "," . $email_reminder . "," . date("Ymd",time()) . "," . $today;

$typeStr = "sssssssssss";

QueryDB_mysqli("INSERT INTO
schedule
SET
userID=?,
end_book =?,
start_book=?,
title=?,
footnotes=?,
start_date=?,
end_date=?,
skip_days=?,
email_reminder=?,
last_accessed=?,
creation_date =?", $typeStr, $varStr);
[END CODE BLOCK]

I can't understand why it wouldn't throw an error yet insert nothing
into the database. Any help would be greatly appreciated.

Thanks in advance,
Joe

Jul 13 '06 #1
2 1392
On 13 Jul 2006 08:38:15 -0700, to*********@gmail.com wrote:
>I have written a function that runs a prepared statement and it seems
to run just fine but when I check to see the affected rows nothing is
affected. Can someone take a look at my code and tell me if they notice
anything wrong outright.

[CODE BLOCK for config.php]
function QueryDB_mysqli($query, $typeStr, $varStr){
$db_connection = new mysqli(DB_HOST, DB_USER, DB_PASSWORD,DB_DATABASE);
$statement = $db_connection->prepare($query);
$statement->bind_param($typeStr, $varStr);
$statement->execute();
$statement->close();
exit();
}
Is autocommit on or off? If off, it's probably doing a rollback at end of
script.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Jul 13 '06 #2
Andy,

Thanks for your reply. Autocommit is turned on. I'm not too
familiar with that function or what you mean by a rollback, but since
it is on I am not sure what to do.
Andy Hassall wrote:
On 13 Jul 2006 08:38:15 -0700, to*********@gmail.com wrote:
I have written a function that runs a prepared statement and it seems
to run just fine but when I check to see the affected rows nothing is
affected. Can someone take a look at my code and tell me if they notice
anything wrong outright.

[CODE BLOCK for config.php]
function QueryDB_mysqli($query, $typeStr, $varStr){
$db_connection = new mysqli(DB_HOST, DB_USER, DB_PASSWORD,DB_DATABASE);
$statement = $db_connection->prepare($query);
$statement->bind_param($typeStr, $varStr);
$statement->execute();
$statement->close();
exit();
}

Is autocommit on or off? If off, it's probably doing a rollback at end of
script.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Jul 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: David.Tymon | last post by:
>Description: MySQL v4.1.0-alpha only allows a client to prepare a maximum of 254 statements. On the 255th mysql_prepare() call, a failure is returned with no information returned by...
8
by: No one | last post by:
I am trying to create a prepared statement in ASP, but am having problems with creating the parameter object. I do the following Set fnParam = peopleUpdate.CreateParameter("@firstname",...
1
by: Tom D | last post by:
I'm rewriting a database interface that our company currently has. Currently it's using the Pear::DB interface, but we found that that was introducing a bit too much overhead. I'm rewriting the...
0
by: phil | last post by:
I am having a problem with the C api with prepared statements, the data recorded in the database does not match the data I am sending. It seems to be some sort of bit shifted version of the data,...
1
by: Me, Myself, and I | last post by:
First off, i apologize if my terminology is off... I am currently in a project that is basically a front-end to a database. In coding this, I am taking into account that it has the *potential*...
3
by: birju | last post by:
Hi, I'm running SQL Profiler on an SQL Server 2000 database. I see that one stored procedure gets repeatedly executed having a handle of '1'. This query takes a long time to complete. How do I...
2
by: ojorus | last post by:
Hi! Some questions regarding the mysqli-extension (php5) 1) Prepared statements: If I understand things right, prepared statements will give better performance if you make several similar...
4
by: TechieGrl | last post by:
Prepared statements are new to me and having to do this with a multi- dimensional array is beyond me. Here is the prepared statement block: // Prepare to insert a record into table1...
6
by: Gordon | last post by:
I want to search a folder structure represented in a database. I'm using the ID and Parent columns model, and would like to be able to search a folder's subfolders as well as teh folder itself. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.