Help on Function?
| From: | Wee Chua | Date: | Wed, 06 Dec 2000 20:30:13 +0000 |
| Subject: | Help on Function? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-28977@lists.php.net to get a copy of this message | ||
Hi all,
Sorry for the previous email. I am using the following codes in my main page
and it works fine but I have to repeatedly put it in every if conditions.
So, i tried to create a funtion called priv_check($insert,$update,$delete)
but once I move the same codes into the function, none of it works. Could
anyone point me out the errors at or how could I fix it?
before I put following codes into function it gave me 1,1,0 of the value
$insert,$update,$delete but after putting it and i got 0,0,0 of those three
variables.
function priv_check($insert,$update,$delete) {
$privilege=@mysql_query("Select Table_priv from
mysql.tables_priv where host='$hostname'
&& db='$mydatabase' && user=
'$PHP_AUTH_USER' && table_name=
'$table'",$db);
$query=@mysql_fetch_array($privilege);
$value_array = explode(',',
$query['Table_priv']);
$select=false;
$insert=false;
$update=false;
$delete=false;
while(list(,$value)=each($value_array))
{
if ($value=='Insert'){
$insert=true;
}
if ($value=='Update'){
$update=true;
}
if ($value=='Delete'){
$delete=true;
}
}
}
Calvin Chua
Systems Analyst
InterClean Equipment, Inc.
734-975-2967