Multiple select stored procedures from mysql

This is a discussion on Multiple select stored procedures from mysql within the PHP General forums, part of the PHP Programming Forums category; I don't understand why the code below doesn't work. I can't seem to do multiple select stored ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-06-2007
mouac01@yahoo.com
 
Posts: n/a
Default Multiple select stored procedures from mysql

I don't understand why the code below doesn't work. I can't seem to
do multiple select stored procedures from mysql. If I close the
connection and reconnect then it works. Funny thing is that I can do
one select and one update stored procedure without closing and
reconnecting, but I can't do 2 selects. I'm using the mysqli
extention with PHP 5.2 and MySQL 5.0. Any ideas? Is this how it's
supposed to work? I'm a newbie so trash my codes as you please.
TIA...

<?php
session_start();
require('DBconn.inc');
$login = "'".$_GET['login']."'";
$role = "'".$_GET['role']."'";
$parm = "";
$parm = $parm."'".$_GET['login']."',";
$parm = $parm."'".substr(sha1($_GET['password']), 0, 10)."',";
$parm = $parm."'".$_GET['first_name']."',";
$parm = $parm."'".$_GET['last_name']."',";
$parm = $parm.$_GET['expire'].",";
$parm = $parm."'".$_GET['role']."',";
$parm = $parm."'".$_GET['dept']."',";
$parm = $parm."'".$_GET['title']."',";
$parm = $parm."'".$_GET['email']."',";
$parm = $parm."'".$_GET['phone']."',";
$parm = $parm."'".$_SESSION['phpAcctSoft-login']."',";
$parm = $parm."'".$_SESSION['phpAcctSoft-login']."'";
$sql = "CALL sy3022a($login)";
$result = $cnn->query($sql);
if ($result->num_rows)
{
$msg = "Login already exist!";
}
else
{
$result->close();
//$cnn->close();
//$cnn = new mysqli('localhost','user','password','db');
$sql = "CALL sy3022b($role)";
$result = $cnn->query($sql);
if (!$result->num_rows)
{
$msg = "Role does not exist!";
}
else
{
$result->close();
$sql = "CALL sy3022($parm)";
$cnn->query($sql);
$msg = "User created.";
}
}
$result->close();
$cnn->close();
echo($msg);
?>

Reply With Quote
  #2 (permalink)  
Old 02-06-2007
P Pulkkinen
 
Posts: n/a
Default Re: Multiple select stored procedures from mysql

Code was quite long to start debug, but often with

error_reporting(E_ALL);
in the beginning and

echo $somesuspectiblevariable;
here and there and

echo mysql_error();
after every query

you can find out a bunch of things..:-)

Hope this helps, sorry if not.


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:55 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0