MySQL Forums
Forum List  »  Newbie

Need Help Turning Into Stored Function
Posted by: Caleb Guenther
Date: September 05, 2008 11:59AM

I'd like to turn the following function into a MySQL stored function, but I'm fairly new to the concept:

int getCharacterLevel(int numXP)
int level = 1;
while (numXP > 4 + level)
numXP -= 4 + level++;
return level;

And then I would like to call it with php like

print mysql_result("SELECT getCharacterLevel(COUNT(XP)) FROM tbl_characters", 0);

Any ideas?

Options: ReplyQuote

Written By
Need Help Turning Into Stored Function
September 05, 2008 11:59AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.