简体   繁体   English

php 中 mysql 表中的 Select 计数(列)

[英]Select count(column) from table of mysql in php

I have a database and I am trying to make a website and connect it to my database.我有一个数据库,我正在尝试创建一个网站并将其连接到我的数据库。 I am trying to count the number of instances in a column but I am having trouble.我正在尝试计算列中的实例数,但我遇到了麻烦。 I have this so far:到目前为止我有这个:

$result =("SELECT COUNT(mediaID) FROM media WHERE 1;");

echo "The number of media posted on the system is ".$result."<br>";

I hope you have the connection done.我希望你已经完成了连接。 Here something is column which you are using to filter the output as desired.这是您用来根据需要过滤 output 的列。

$result="select count(mediaID) from media where something="1"";
echo" the sentence".$result"."

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM