MySQL Forums
Forum List  »  Stored Procedures

Re: PHP mysql stored procedure execution problem
Posted by: Adilson Carvalho
Date: October 03, 2005 08:57AM

Hi everyone,

Every time I call a stored procedure I lost my connection to the server.

//
// o prĂ³prio strtodate :p
$placa = $_SESSION['tomada']['placa'];
$data = preg_replace( '/(\d+)\/(\d+)\/(\d+)/i' , '$3-$2-$1' , $_REQUEST[ 'dt_lancamento' ] );
$km = intval($_REQUEST['km_tomada']);

/*--------------------------------------------------------------------*/

if( ! $result = $mysqli->query( "CALL spcveiculonovatomadakm(\"$placa\", \"$data\", $km);" ) )
{
printf("cadastrando na spc :: Error: %s\n", mysqli_error($mysqli));
exit(0);
}

$_SESSION['mensagem'][] = "CALL spcveiculonovatomadakm(\"$placa\", \"$data\", $km);";

while ($row = $result->fetch_array())
{
$_SESSION['mensagem'][] = $row[0];
}

/*--------------------------------------------------------------------*/

/* I allways have to reconect to my server after calling a stored procedure */
unset($mysqli);
$mysqli = new mysqli("localhost", "root", "-", "desenv");

$_SESSION['tomada']['historico'] = array();

$sql = "SELECT * FROM vveiculotomadahistorico WHERE nr_placa = '";
$sql .= $_SESSION['tomada']['placa'];
$sql .= "';";

if ($result = $mysqli->query( $sql ))
{
while ($row = $result->fetch_assoc())
{
$row['dt_tomada'] = strtotime($row['dt_tomada']);
$_SESSION['tomada']['historico'][] = $row;
}
}
else
{
printf("gerando a lista :: Error: %s\n", mysqli_error($mysqli));
exit(0);
}
// $myresult->free();

/*--------------------------------------------------------------------*/

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: PHP mysql stored procedure execution problem
3965
October 03, 2005 08:57AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.