Hello, I have this silly bug.
<code>
<?
function staffEcho($infoType){
$query = Mysql_Query("SELECT * FROM staff", $connection);
$rows = Mysql_Num_Rows($query);
for ($a=0; $a<$rows; $a++)
{
$echoThis = Mysql_Result($query, $a, $infoType);
echo($echoThis . "<br>");
}
}
?>
</code>
which is called with
<code>
<? staffEcho("staff_nick_name");?>
</code>
gives the error
"Warning: Supplied argument is not a valid MySQL-Link resource in includes/staff.php on line 5"
When everything is in one place and it is done like
<code>
<?
function staffEcho($infoType){
$query = Mysql_Query("SELECT * FROM staff", $connection);
$rows = Mysql_Num_Rows($query);
for ($a=0; $a<$rows; $a++)
{
$echoThis = Mysql_Result($query, $a, "staff_nick_name");
echo($echoThis . "<br>");
}
}
?>
</code>
it works fine. It's when I turn it into a function that I call it doesn't work. Any ideas .. ?
Thanks in advance!