Re: I hate bugs...Mysqli issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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:
On Dec 21, 2007, at 11:22 AM, Zoltán Németh wrote:

2007. 12. 21, péntek keltezéssel 11.14-kor Jason Pruim ezt írta:
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émeth


Here is where I connect to the database:

<?php



$link = mysqli_connect($server, $username, $password, $database) ;

/* check connection */
if (mysqli_connect_errno()) {
    printf("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....


try a var_dump on $link and on $stmt after the mysqli_prepare and see
what it shows

greets
Zoltán Németh

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?





--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
japruim@xxxxxxxxxx




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
japruim@xxxxxxxxxx





--

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux