On Jan 8, 2008, at 12:22 PM, Jack Mays wrote:
Jason Pruim wrote:
Hi Everyone,
Happy New Year a week late! :)
I am trying to get more serious with my programming, I feel fairly
confident in my basic abilities except for one... Error checking.
That's what I'm trying to get figured out :)
I have a script, that I am using to connect to my database, read,
insert, delete or edit the records in there.
most of the time the script works perfectly, but on the occassion
it doesn't like when jupiters third moon aligns with uranus, I want
the user to be notified to take their head out of their ass... :)
What I have tried is this:
$querytest = "INSERT INTO current VALUES
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
if ($stmt = mysqli_prepare($link, $querytest)) {
mysqli_stmt_bind_param($stmt, 'ssssssssss', $FName, $LName,
$Add1, $Add2, $City, $State, $Zip, $XCode, $Record, $Reason);
//Add the record
mysqli_stmt_execute($stmt);
printf("Error: %d.\n", mysqli_stmt_errno($stmt));
printf("%d Row Inserted.\n", mysqli_stmt_affected_rows($stmt));
}
//Close the statement
mysqli_stmt_close($stmt);
that was pulled off of the php.net site (For the most part) and
adapted slightly to meet my needs, and obviously I edited too much
of it :)
If anyone has any ideas I would appreciate it. Even RTFM as long as
$M is defined :)
What, if any, errors are given when the query doens't work? Are any
of the field in mysql set to be unique and are you trying to insert
a new row with some of the same information?
I dont see anything wrong right off the bat with the way you are
performing the task.
Actually, the problem isn't the query... the query works fine. What I
want is for if it doesn't work, I want it to tell the user that it
didn't work.
Right now I'm just blindly accepting that the insert succeeded, and I
want to get away from that! :)
Does that explain it a little better?
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
japruim@xxxxxxxxxx
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php