Here goes:
I have a functions file with this function in it, the function mysqlConnect() is above and works fine.
Code: Select all
function categories() {
global $MySQL;
mysqlConnect();
$query = "SELECT * FROM ".$MySQL['table_prefix']."".$MySQL['categories_table']."";
$result = mysql_query($query) or die (mysql_error());
while($row = mysql_fetch_array( $result )) {
return "<option value=\"".$row['id']."\">".$row['category']."</option>";
}
}
I then have a file that calls this function in a variable ex)
Code: Select all
$content = "Categories: <br /> <select name=\"category\">".categories()."</select>
The problem is that when I do this, only the first row shows up in the select, because I realize return quits after it returns the first select, I was attempting to do this with arrays or echo, which would just echo the select at the top of the page before echo $content; was stated.
I do not have much experience with using arrays so any help would be useful !
Thanks a lot.