Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
i have this stored function that would essentially return variable, the code is as follow:
[syntax="sql"]CREATE DEFINER=`DATABASE`@`%` FUNCTION `sf_GetUserID`(inUserEmail varchar(200)) RETURNS char(7) CHARSET latin1
BEGIN
declare returnUserID char(7);
select userID into returnUserID
from Users
where userEmail = inUserEmail;
return returnUserID;
ENDi would then write the following in PHP:[/syntax]
Code: Select all
$getUserIDQuery = "call sf_GetUserID('".$inUserEmail."')";
// executes the query string, and SHOULD assign the result to $userID.
if($userID = $mysqli->query($getUserIDQuery))
{
echo (string)$userID;
// testing to see if $row = $result->fetch_field() is really working. if it is, then print "<BR/>its working<BR/>"
// if($row = $userID->fetch)
// {
// print "<BR/>its working<BR/>";
// }
// echo $row[returnUserID];
}
else
{
echo "ERROR:".$mysqli->error."<BR/>";
}
$mysqli->close();at first, it says that the stored funciton does not exist, but it DOES.
also, it also tells me that it can not convert it to string.
please help.
xiaofei
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]