我在此代码的第4行发生错误。这对我没有意义。它昨天工作,现在它没有。执行此脚本后出错?
以下是错误信息,我得到我包括此之后: Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in /PATH/classes/users.php on line 5
<?php
class Users {
public static function load($where = NULL, $order = 'name', $bind = NULL) {
global $db;
$sql = 'SELECT cspsp_accounts.*, cspsp_clans.id AS clan_id, cspsp_clans.name AS clan_name, cspsp_clans.tag AS clan_tag ' .
'FROM cspsp_accounts ' .
'LEFT JOIN cspsp_clanlinks ON cspsp_accounts.id=cspsp_clanlinks.account_id AND cspsp_clanlinks.active=1 AND cspsp_clanlinks.approved=1 ' .
'LEFT JOIN cspsp_clans ON cspsp_clans.id=cspsp_clanlinks.clan_id ' .
'WHERE (cspsp_accounts.id=cspsp_clanlinks.account_id OR cspsp_clanlinks.account_id IS NULL) ' . (($where) ? ('AND (' . $where . ') ') : ('')) .
'ORDER BY ' . $order;
$rows = $db->run($sql, $bind);
if(is_array($rows)) {
$users = array();
foreach($rows as $row) {
$users[] = new User($row);
}
return $users;
}
return false;
}
}
?>
下面是完整的代码:http://codepad.org/1qS7iwTv 谢谢大家先进!
'公布ic静态函数加载(..'给我一个错误。 – VladHQ 2013-05-12 11:30:36
我刚刚复制/粘贴你的代码,它工作正常。这是你的整个PHP文件? – 2013-05-12 11:36:37
对不起偏离的问题。我不禁注意到开发人员正在使用内联sql语句。我已经完成了几个问题。我不确定他们是否将SQL注入攻击视为一个大问题。 – 2013-05-12 11:36:50