Hey, I'm trying to use a function to get data from a database and then send it to my script. I'm fairly new to functions and I thought this would work but it didn't.
Here's my function:
function showMasterClients () {
$showMasterClients = mysql_query("SELECT * FROM database_spysupply.clients WHERE clients_subof IS NULL ORDER BY clients_ln ASC") or die(mysql_error());
return $showMasterClients;
}
And the code where I want to use the returned clients:
<?
showMasterClients();
?>
<select name="clients_subof" id="clients_subof">
<option>Select Master Account</option>
<?
while ($row = mysql_fetch_assoc($showMasterClients)) {
$clients_ln = $row["clients_ln"];
$clients_fn = $row["clients_fn"];
echo "<option value=\"clients_id\">$clients_ln, $clients_fn</option>";
}
?>
</select>
I get no results. Can anyone share what I'm doing wrong?
Thanks!!