This is my Stored Procedure
DELIMITER $$
DROP PROCEDURE IF EXISTS `call`.`sp_login`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_login`(userid varchar(50),pass varchar(50),out chk int(11),out user_alias varchar(50),out user_tariff varchar(50),out c_credit decimal(15,5),out r_reseller varchar(10),out r_level varchar(10),out c_tariff char(2))
BEGIN
select id into chk from cc_reseller where useralias =userid and uipass=pass and level!=0 and activated!='0';
if(chk!="") then
select id,useralias,tariff,credit,reseller,level,create_tariff into chk,user_alias,user_tariff,c_credit,r_reseller,r_level,c_tariff from cc_reseller where useralias =userid and uipass=pass and activated!='0' and level!=0;
end if;
END$$
DELIMITER ;
This is my Php Code to call StoreProcedure
<?php
ob_start();
include_once('config.php');
$username = $_POST['username'];
$password = $_POST['password'];
if (isset($_POST['username']) && $_POST['username']!='')
{
$username=$_POST['username'];
$password=$_POST['password'];
$query="call sp_login('$username','$password',@chk,@user_alias,@user_tariff,@c_credit,@r_reseller,@r_level,@c_tariff)";
$result=mysql_query($query) or die('Query error'.''.mysql_error());
$count=mysql_fetch_row($result);
$chk = $count[0];
if($chk !="")
{
$n_name = $count[1];
$n_tariff = $count[2];
$n_username = $count[3];
$n_creator = $count[4];
$n_credit = $count[5];
$_SESSION['username'] = $n_username;
$_SESSION['user_id'] = $chk;
$_SESSION['tariff'] = $n_tariff;
$_SESSION['reseller'] = $n_creator;
$_SESSION['ncredit'] = $n_credit;
header('Location:welcomes.php');
}
else
{
header("location:index.php?q=-2");
}
}
else
{
if(!isset($_SESSION['username']) || $_SESSION['username']=='')
{
header("location:index.php?q=-1");
}
}
?>
Can anyone tell where i m wrong..
is it true that Out parameter doesnt work with mysql..???
Help me out