Hello friends..
Help me out..!!

this is my Procedure..which working fine in mysql...!!

DELIMITER $$

DROP PROCEDURE IF EXISTS `myp`.`insert_1`$$

CREATE PROCEDURE `myp`.`insert_1`(gname varchar(30),userid int,classtype int )
BEGIN
	if exists (SELECT * FROM 0_groups where groupName=gname AND USER_ID IN(userid,'0')) then
SELECT 1 as error;
else 
insert into 0_groups(groupName,classType,user_id)values(gname,classtype,userid) ;
select 2;
end if;

END$$

DELIMITER ;

but when i call it php.. it does not work..!!

$query="call insert_1('$gname','$userid','$gtype')";     $result=mysql_query($query) or die('query error'.''.mysql_error()); 
    $count=mysql_num_rows($result) ;
    
    if($count < 0)
    {
        header('location:group.php?q=4');    
    }
    else
    {
        header("Location:group.php?q=1");
    }

where i am making mistake..?? help me out..!! plzz..!!

Try this:

$query="call insert_1('$gname',$userid,$gtype)";

Since the last 2 parameters are int's, i think they don't need quotes.

I have tried that also..!!
still showing error...!!!!

No replies... i think nobody knows about it..!! :O
Is it that dificult..??

Query Error : PROCEDURE myp.insert_1 can't return a result set in the given context

Any info I could find online regarding this error, points to using mysqli instead of mysql as a solution.

Hi,
I had a problem running a stored procedure from MySql recently too. The only work around I found was to create use the php mysqli functions when working with the procedure, and mysql the rest of the time.

Regards,

Rob.

Any info I could find online regarding this error, points to using mysqli instead of mysql as a solution.

Can you help me how to use Mysqli..!!

mysqli = new mysqli("localhost","root","pass",false, 196608)

this showing error: mysqli class is missing...!! :O

What version of PHP are you using? It is only available in PHP version 4.1.3 or later.
Also, you can find a tutorial for MySqli here. To find this, I googled for mysqli tutorial.

Regards,

R.

What version of PHP are you using? It is only available in PHP version 4.1.3 or later.
Also, you can find a tutorial for MySqli here. To find this, I googled for mysqli tutorial.

Regards,

R.

I m using 5.2 version...!! i tried the same code... that showing error missing mysqli class..!!

Is there any change i have to made in my php.ini..???? :O

Nish123, now that I've told you to use MySqli, and you've received the error of class not found, have you actually bothered to search for a solution to the problem yourself?

By using Google again, I found this. Ah, hell with it, send me the code, and I'll write it for you!!! - NOT.

Start putting some effort in yourself!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.