Counting members from MySQL

User avatar
JanMolendijk
Posts: 115
Location: Holland Rotterdam

Counting members from MySQL

Chef i`m back hoping you could help me with this.
i think i need just one example then i can build a score-board for the members...

I have two examples where i want to make a count from both variables i would like to have a count-up +

Code: Select all

<?php include('connection.php'); $result = $conn->query("SELECT COUNT(*) FROM `addon_message` WHERE friend_id='$users[id]'"); $row = $result->fetch_row(); echo ' ', $row[0]; ?>
And:

Code: Select all

<?php include('../connection.php'); $result = $conn->query("SELECT COUNT(*) FROM `member_access` WHERE user_id='$users[id]'"); $row = $result->fetch_row(); echo ' ', $row[0]; ?>
Edit:
Strange i searching the whole day, but counters like + - * i can`t find them
But this one is also funny what i found & gonna use:

Code: Select all

<?php $mystring = $row1[0]; $findme = '8'; $pos = strpos($mystring, $findme); // Note our use of ===. Simply == would not work as expected // because the position of 'a' was the 0th (first) character. if ($pos === false) { echo ""; } else { echo "Active Member"; echo "Great Score"; } ?>
Still i hope you have a answer for me (example).

Admin
Hello,
I didn't understand what counting you want to make.
If it is something with Up and Down, '+' or '-', like a voting, I have this script:
http://coursesweb.net/php-mysql/voting- ... pt-ajax_s2

Anyway, if you already have found something that you can use, it's ok.

JanMolendijk
Dear Admin i just looking for a simple sum up
1 + 1 = 2 strange i cant find it on the internet
or i use the wrong searching words

JanMolendijk
i found something like this but
now is my question how to use x - /

Code: Select all

<?php $a = array($row[0], $row1[0]); echo "sum(a) = " . array_sum($a) . "\n"; $b = array("a" => 1.2, "b" => 2.3, "c" => 3.4); echo "sum(b) = " . array_sum($b) . "\n"; ?>

JanMolendijk
Well i searching in dutch lang & now i found them all
But still thanks for supporting :)

Code: Select all

<?php $waarde1 = $row[0]; $waarde2 = $row1[0]; $optellen = $waarde1 + $waarde2; echo $optellen; ?>

Code: Select all

<?php $waarde1 = 10; $waarde2 = 5; $aftrekken = $waarde1 - $waarde2; echo $aftrekken; ?>

Code: Select all

<?php $waarde1 = 10; $waarde2 = 5; $vermenigvuldigen = $waarde1 * $waarde2; echo $vermenigvuldigen; ?>

Similar Topics