I'm trying to count how many rows that have the same value as a variable.
Then I wanna echo out the number that is calculated in the mysql query! Is this possible?
Here is a image of my database:
http://img812.imageshack.us/img812/333/9jr1.png
Sorry for my bad English and if the question is hard to understand (new to this stuff)
Here it is from your old question
$query= "SELECT pic_name, count(pic_name) as count FROM hulebild_likes where pic_name='$bild_id'";
$likesf = mysqli_query($con, $query);
$row=mysqli_fetch_array($likesf);
echo $row['count'];
There are two different approaches here. If you're looking for a specific value and know it in advance, you can do something as simple as:
select count(*) as count from table where column = 'value';
Alternatively, if you're just looking for a count of duplicate values, you could go with something like:
select count(*) as count, column from table group by column;
That will give you two columns: your column of values and how many occurrences there are of each value.
Execute a SQL query like this:
SELECT COUNT(*) FROM yourtablename WHERE yourcolumnname = yourvariablevalue;