I have created a custom function and I am getting this error. I dont think there is a “parse error” in my script.
Parse error: syntax error, unexpected ',', expecting '&' or T_VARIABLE in C:\wamp\www\web template\test.php on line 8
<?php
require('global script/php/dbConnect.php');
$varName = 'sd';
echo checkDBDuplicate('account_list', 'memberID', $varName);
function checkDBDuplicate(tableName, dbFieldName, variableName)
{
$tableName = tableName;
$dbFieldName = dbFieldName;
$variableName = variableName;
$searchDuplicate = mysql_query('
SELECT $dbFieldName
FROM $tableName
WHERE $dbFieldName = $variableName
') or die(mysql_error());
$countRow = mysql_num_rows($searchDuplicate);
return $countRow;
}
?>
The purpose of this script is to test if I can use a variable in a SELECT statement.
Variables should have a
$prefix. sois wrong, make it
obviously, further on the same is true, so:
needs the same treatment