![]() |
|
|
|
|
1
8th November 18:07
External User
Posts: 1
|
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 ![]() -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com japruim@raoset.com |
|
|
|
|
4
8th November 18:07
External User
Posts: 1
|
As I said in the other e-mail, the query works just fine. But if for
some reason the insert doesn't succeed I want it to tell the user that it didn't succeed and that they should call their friendly underpaid under-appreciated network admin (AKA: ME )-- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com japruim@raoset.com |
|
|
5
8th November 18:07
External User
Posts: 1
|
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@raoset.com |
|
|
10
8th November 18:08
External User
Posts: 1
|
Only on special occasions... Besides, isn't that illegal in every
state but PA? Tried to do that, and couldn't get it to work, but as I noted in another e-mail, I found away that I think will work! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com japruim@raoset.com |
|
| Some other forums that might be of your interest : Php 5 forum, Apache forum, Iis forum, Functions forum, Classes forum, Librarys forum, Bugs forum, Postgres forum, Mysql forum, Paradox forum, Ms sql forum, Configurations forum, Php.ini forum, Problems forum, Scripting forum, Css forum, General forums, Off-topic talk, Links, Extra forums, Php |