I have this php function which looks up rows from a database table
if (!function_exists("ContactLookup")) {
function ContactLookup($column, $clause, $value, $limit1=0, $limit2=1)
{
global $conn;
$ContactLookup_Sql= "select * from contacts where $column $clause $value LIMIT $limit1, $limit2";
$ContactLookup_Rs = mysql_query($ContactLookup_Sql,$conn);
while ($ContactLookup_Result = mysql_fetch_array($ContactLookup_Rs)) {
$foremame =$ContactLookup_Result["forename"];
$surname = $ContactLookup_Result["surname"];
}
}
}
This just echoes the results but if I wanted to put the results into a select element how would I do this
Within the while loop would I create the variables then echo the variables when I call the function? Or is there another way around this?
Like:
<?php ContactLookup("company_sequence", "=", $result["contact"],"0","10"); ?>
><select name="contactsequence" id="contactsequence">
<option value=""><?php echo $forename; ?></option>
</select