Skip to content
Advertisement

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>";

Advertisement

Answer

I hope you have the connection done. Here something is column which you are using to filter the output as desired.

$result="select count(mediaID) from media where something="1"";
echo" the sentence".$result"."
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement