Return true from a stored procedure
Posted: Tue Mar 24, 2009 10:27 am
Hi, I have never created a stored procedure so please bear with me. I wish to create a stored procedure where if a condition is met true is returned, else false is returned, something like:
CREATE PROCEDURE SomeName(IN X VARCHAR(15), IN Y VARCHAR(30))
BEGIN
SELECT A, B
FROM Table
//Go through table and
IF A == X AND B == Y return true, else return false
END;
How can I achieve this? Further, how can I display the bool result in the statement:
$res = mysql_query("call SomeName($textA, $textB)");
if (!mysql_query($res,$con))
{ die('Error: ' . mysql_error());
}
I will be grateful for all help.
CREATE PROCEDURE SomeName(IN X VARCHAR(15), IN Y VARCHAR(30))
BEGIN
SELECT A, B
FROM Table
//Go through table and
IF A == X AND B == Y return true, else return false
END;
How can I achieve this? Further, how can I display the bool result in the statement:
$res = mysql_query("call SomeName($textA, $textB)");
if (!mysql_query($res,$con))
{ die('Error: ' . mysql_error());
}
I will be grateful for all help.