Multiple prepared statements and preparing a stored procedure...
am 05.06.2007 20:14:49 von Ken Keefe
Is it possible to have multiple prepared statements associated with a
single mysqli object at one time?
For example:
$db = new mysqli($sqlServer, $sqlUser, $sqlPass, $sqlDB);
$query1 = $db->prepare($sql1);
$query2 = $db->prepare($sql2);
foreach ($arr as $key => $val)
if($val)
{
$query1->bind_param("s", $key);
$query1->execute();
}
else
{
$query2->bind_param("s", $key);
$query2->execute();
}
$query1->close();
$query2->close();
Also, is there any benefit to using a prepared statement to call a
stored procedure? If so, how do I prepare another statement after the
stored procedure? I keep getting an error about being out of sync...
Thanks,
Ken
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Multiple prepared statements and preparing a stored procedure...
am 06.06.2007 03:39:55 von bedul
nope!!
unless u build 2 class.. that's for save actualy..
$db1 = new mysqli($sqlServer, $sqlUser, $sqlPass, $sqlDB);
$db2 = new mysqli($sqlServer, $sqlUser, $sqlPass, $sqlDB);
----- Original Message -----
From: "Ken Keefe"
To:
Sent: Wednesday, June 06, 2007 1:14 AM
Subject: [PHP-DB] Multiple prepared statements and preparing a stored
procedure...
> Is it possible to have multiple prepared statements associated with a
> single mysqli object at one time?
>
> For example:
>
> $db = new mysqli($sqlServer, $sqlUser, $sqlPass, $sqlDB);
> $query1 = $db->prepare($sql1);
> $query2 = $db->prepare($sql2);
> foreach ($arr as $key => $val)
> if($val)
> {
> $query1->bind_param("s", $key);
> $query1->execute();
> }
> else
> {
> $query2->bind_param("s", $key);
> $query2->execute();
> }
> $query1->close();
> $query2->close();
>
>
> Also, is there any benefit to using a prepared statement to call a
> stored procedure? If so, how do I prepare another statement after the
> stored procedure? I keep getting an error about being out of sync...
>
> Thanks,
> Ken
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php