I'm a complete PHP noob (and any other language for that matter), what i wanna know is why will this only return 1? No matter how many players the user has.
Also on SOME pages I wanna display them in a <select> menu how can I do that?
function get_players($aid) {
$query = query("SELECT name FROM player WHERE account_id = $aid");
while ($row = fetch_assoc($query)) {
return $row['name'];
}
}
echo get_characters(1337);
SELECT count(name) AS totalin your query, and then return$row['total']returnends the execution of the function, you should put the values in an array or an object and then return it when the loop is done1? You define a functionget_players(), but only callget_characters(), which isn't defined in the code you posted. Which function are you talking about?