Hi guys i'm making tutorial how to make statistics from mysql data,for example i'll use someone's post count
As first we should do a mysql_querry to get the data
$a = mysql_query("SELECT posts FROM smf_members WHERE name = "kingW3"");
Here $a is a variable which we will use later
Now if we wan't error reporting in case it doesn't works
if (!$a) {
echo 'Could not run query: ' . mysql_error();
exit;
Now we asked computer is $a false(exclamation mark defines it as false) if it's false than it will echo Could not run query and mysql_error and quit.After that we should get the data from $a variable for that we will gonna use mysql_fetch_row
$b = mysql_fetch_row($a);
Now you should do the same just use another name instead of kingW3
<?php
$c = mysql_query("SELECT posts FROM smf_members WHERE name = "Icypig"");
if (!$c) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$f = mysql_fetch_row($c);
?>
Now we can compare post count
echo $f[0] - $b[0] // [0] is used because it's the first thing in the select for example if we used posts and id,id would be selected with [1]
Now this should output the substractin of icypig's post count and mine post count
If you doesn't understand some part or have problems with this code pm me