mysql计入PHP变量

mysql计入PHP变量,第1张

mysql计入PHP变量

像这样:

// Changed the query - there's no need for DISTINCT// and aliased the count as "num"$data = mysql_query('SELECt COUNT(`users_id`) AS num FROM `users_table`') or die(mysql_error());// A COUNT query will always return 1 row// (unless it fails, in which case we die above)// Use fetch_assoc for a nice associative array - much easier to use$row = mysql_fetch_assoc($data);// Get the number of uses from the array// 'num' is what we aliased the column as above$numUsers = $row['num'];


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5044021.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-15
下一篇 2022-11-15

发表评论

登录后才能评论

评论列表(0条)

保存