if ( empty(trim($rowuserlist['country'])) ){ die('country is empty'); } $country = mysql_real_escape_string(strtolower(str_replace(" ","_",$rowuserlist['country']))); $sql = "SELECT username, country, money, rank, fav_saying, fav_person, last_login FROM ".$country." ORDER BY username ASC"; $countrytablequery = mysql_query($sql); or die(mysql_error() . '
' . $sql);