我试图计算'类代码中的条目数量'我的数据库的列有' class1'作为值,然后将此数字转换为PHP变量。我出错的任何想法?任何帮助非常感谢
ifstream inputfile;
string line;
if (inputfile.is_open())
{
while (getline(inputfile,line))
{
cout << line << endl;
}
inputfile.close();
}
答案 0 :(得分:1)
试试这个:
$result = mysql_query("SELECT COUNT(classcode) as count FROM playerinfo WHERE classcode='class1'");
$result_array = mysql_fetch_assoc($result);
$count = $result_array['count']
echo $count;