我有这个代码:
<?php
class guildData {
public $email = NULL;
public $hash_pw = NULL;
public $user_id = NULL;
public $clean_username = NULL;
public $display_username = NULL;
public function selectGuild($g_id)
{
global $db,$db_table_prefix;
$this->g_id = $g_id;
$sql = "SELECT
name
FROM
guild
WHERE
id = '".$g_id."'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
return ($row['name']);
}
}
?>
<?php echo $guildData->selectGuild(1); ?>
我只是收到一个 500 错误,IDEone 也给了我这个:
致命错误:在第 32 行的 /home/VT00Ds/prog.php 中的非对象上调用成员函数 selectGuild()
我看不到错误,你能帮帮我吗?