I need new eyes, can someone help me

+1 Glenn Cook · December 11, 2015
I have the following errors :
Warning: func_get_arg() expects exactly 1 parameter, 0 given in E:\server\htdocs\core\functions\users.php on line 9

Fatal error: Cannot redeclare sanitize() (previously declared in E:\server\htdocs\core\functions\general.php:2) inE:\server\htdocs\core\functions\general.php on line 4

code as follows:

function sanitize($data){
return mysql_real_escape_string($data);

function output_errors($errors){
$output = array();
foreach($errors as $error){
$output[] = '<li>'. $error. '</li>';
return '<ul>'. implode('',$output) . '</ul>';
function user_data($user_id){
$data = array();
$user_id = (int)$user_id;

$func_num_args = func_num_args();
//echo $func_num_args;
$func_get_args = func_get_arg();
//echo $func_get_args;
function user_exists($username){
$username =  mysql_real_escape_string($username);
$query = mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE `username` = '$username'");
return (mysql_result($query, 0) == 1) ?true : false;
function user_active($username){
$username =  mysql_real_escape_string($username);
$query = mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE `username` = '$username' AND `active` = 1");
return (mysql_result($query, 0) == 1) ?true : false;

function user_id_from_username($username){
$username =  mysql_real_escape_string($username);
return mysql_result(mysql_query("SELECT `user_id` FROM `users` WHERE `username` = '$username'"), 0, 'user_id');
if(logged_in() === true){
$session_user_id = $_SESSION['user_id'];
$user_data = user_data($session_user_id, 'user_id', 'username', 'password','first_name', 'last_name', 'email');
Please help me

Post a Reply


Oldest  Newest  Rating
0 Superman HC · December 26, 2015
So the first error requires an argument in func_get_arg(// index of the parameter that you want to retrieve from the declaration).. in this case i guess you need username so func_get_arg(2)

The second error seems to be a haunted as it says error on line 4.. but there is actually nothing on line 4.. if i make a random guess,, make sure you don't have another file with the same name i,e, general.

Just an advice... it is mentioned in the policies of the forum that your subject should be relevant with the post and it should clearly defines the problem... hahaha just kidding:D
  • 1



Server-side, HTML embedded scripting language used to create dynamic Web pages.