This error occurs when a query to the database passed in the function parameter mysql_fetch_assoc
returned failure (FALSE), instead of a set of records from the database or success (when modifying a data set, for example), TRUE. The request itself looks a little suspicious. This is probably because I do not know the structure of your table. And this block of code is generally terrible:
unset($func_get_args[0]); $fields = '`' . implode('`, `', $func_get_args) . '`'; // здесь вы, не окажется запятых между полями...скорее, потому и ошибка. И вообще, возьмите к примеру, первое поле массива. Оно будет такого вида в миссиве **'`field'**, потому что это **'`, `'** не всегда будет верно... $data = mysql_fetch_assoc(mysql_query("SELECT $fields FROM `users` WHERE `user_id` = $user_id"));
One thing only:
$fields = '`' . implode('`, `', $func_get_args) . '`';
How much sadness brought me ...
Try replacing this:
unset($func_get_args[0]); $fields = implode(',', $func_get_args); // бьем поля по запятым, вместо вашего ужаса. $fields = mysql_real_escape_string($func_get_args[0]); // подготавливаем к запросу. $data = mysql_fetch_assoc(mysql_query("SELECT $fields FROM `users` WHERE `user_id` = $user_id")); // запросим
In general, it is better not to create your own hemorrhoids with these fields, because you can select all the fields, it will work almost as fast as your implode () ...