View Single Post
  #2  
Old 11-10-2014, 08:50 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 22,929
IntoRain is on a distinguished road
Default

You can actually put your condition inside the query

$count = $mysidia->db->select("owned_adoptables", array("aid"), "owner='{$mysidia->user->username}' and currentlevel >= {$req_lvl}")->rowCount();

That will return how many rows there are with that information. So if user doesn't have an adoptable with that minimum level, it returns 0

$theOne = $mysidia->db->select("owned_adoptables", array(), "owner='{$mysidia->user->username}' and currentlevel >= {$req_lvl} limit 1")->fetchObject();

This will return the whole row. I limited it by one because it might have more than one at max level. So you can access their information now with stuff like:

$hisName = $theOne->name;
__________________


asp.net stole my soul.

Last edited by IntoRain; 11-10-2014 at 09:09 PM.
Reply With Quote