Re: I hate bugs...Mysqli issue
| From: | Jason Pruim | Date: | Fri, 21 Dec 2007 17:04:57 +0000 |
| Subject: | Re: I hate bugs...Mysqli issue | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-266210@lists.php.net to get a copy of this message | ||
On Dec 21, 2007, at 12:01 PM, Zoltán Németh wrote:
2007. 12. 21, péntek keltezéssel 11.50-kor Jason Pruim ezt írta:Hey Zoltan, Thanks for looking, here's the result of the vardump, I did $link first and then $stmt object(mysqli)#1 (0) { } bool(false) Not quite what it should be is it?On Dec 21, 2007, at 11:22 AM, Zoltán Németh wrote:try a var_dump on $link and on $stmt after the mysqli_prepare and see what it shows greets Zoltán Németh2007. 12. 21, péntek keltezéssel 11.14-kor Jason Pruim ezt írta:Here is where I connect to the database: <?php $link = mysqli_connect($server, $username, $password, $database) ; /* check connection */ if (mysqli_connect_errno()) {Hi everyone. I have a script that I've been using succesfully for quite awhile, and just today found a bug... I attempted to insert a new record into the database and got this error in my error log: [Fri Dec 21 11:08:43 2007] [error] PHP Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in /Volumes/RAIDer/webserver/Documents/OLDB/add.php on line 31 [Fri Dec 21 11:08:43 2007] [error] PHP Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in /Volumes/ RAIDer/webserver/Documents/OLDB/add.php on line 33 [Fri Dec 21 11:08:43 2007] [error] PHP Warning: mysqli_stmt_affected_rows() expects parameter 1 to be mysqli_stmt, boolean given in /Volumes/RAIDer/webserver/Documents/OLDB/add.php on line 35 [Fri Dec 21 11:08:43 2007] [error] PHP Warning: mysqli_stmt_close() expects parameter 1 to be mysqli_stmt, boolean given in /Volumes/ RAIDer/webserver/Documents/OLDB/add.php on line 41 And those lines from my script are: //Create the statement $stmt = mysqli_prepare($link, "INSERT INTO current VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"); mysqli_stmt_bind_param($stmt, 'sssssssss', $FName, $LName, $Add1, $Add2, $City, $State, $Zip, $XCode, $Record); //Add the record mysqli_stmt_execute($stmt); printf("%d Row Inserted.\n", mysqli_stmt_affected_rows($stmt)); // Redirect back to index.php for viewing //header("Location: index.php"); //Close the statement mysqli_stmt_close($stmt); ?> The $stmt is line 30 only thing above it is mapping the post info to the field names to be inserted. With my limited knowledge of mysqli functions, it could be the issue... But what I don't get is why this bug is rearring it's head now... When I'm supposed to go on vacation for a few weeks... Any help would be greatly appreciated. The basics of what I used was copied directly from the php.net site. so I'm very confused...an error must have occurred with mysqli_prepare, so it returned a boolean false, that's what all those warnings are complaining about... are you sure $link is a valid mysqli link identifier? greets Zoltán Némethprintf("Connect failed: %s\n", mysqli_connect_error()); exit();} ?> It looks valid to me... as long as it's connecting... the username/ password/database are all correct, I can log in from the command line with no issue....
-- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com japruim@raoset.com-- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com japruim@raoset.com-- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com japruim@raoset.com