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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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); ?> |
|
|||
|
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. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|