I'm trying to undestand classes by building a databse abstraction layer, however I have hit a brick wall with this function.
What I'm trying to do is write a function that will return all records in a table and output them to pre-formatted string.
This is the function
Code: Select all
function rowFormated($table,$output)
{
$query=mysql_query("SELECT * FROM $table");
while ($row =@mysql_fetch_array($query))
{extract($row);
$result .= $output;};
return $result;
}I see the function being executed like this
Code: Select all
$contacts=rowFormatted(table,"name:$name Address: $address<br/>");
echo $contacts;