Okay, I'm running the following sql query $sql = " SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . " WHERE item_in_shop = 0 AND item_in_warehouse = 0 AND item_duration > 0 AND item_owner_id = $user_id AND item_type_use = 50 "; { message_die(GENERAL_ERROR, 'Could not query battle list', '', __LINE__, __FILE__, $sql); } $ammo = $db->sql_fetchrow($result); PHP: What I want to do is add some code like if(no entries found for search) { post message } I know how to do the message, but I'm not sure how to write the if statement. Could someone help please?
$sql = "[your sql statement here]"; $rst = mysql_query($sql); if(mysql_num_rows($rst) > 0) { // code if found } else { // code if not found } Code (markup):