I have another problem with mysql.
I have 3 tables (Users, User_status and Analysis). Users and User_status are in relation (Users.User_status_name=User_status.user_status) and Users and Analysis are in relation (Users.Username=Analysis.Tipster).
I want to have table in php:
Tipster Form
boskor 1W 1V 0L
slopart 0W 1W 2L
In table Analysis I have row (Status_name with these options (Won, Void, Lost)). Now I want to have how many rows have status Won, how many rows status Void and status Lost.I also want to limit this (won+void+lost<=20) and ORDER BY Status_name.
I have this table:
$tipster = mysql_query("SELECT Users.id, Users.Username, User_status.id_status
FROM Users
INNER JOIN User_status
ON Users.User_status_name=User_status.user_status
left outer JOIN Analysis
ON Users.Username=Analysis.Tipster
WHERE User_status.id_status>=3
GROUP BY Tipster");
while ($row = mysql_fetch_array($tipster)) {
$sel_tipster=$row['Username'];
$sel_tipster_id=$row['id'];
echo "<tr>";
echo "<td>";
echo $sel_tipster;
echo "</td>";
I don't know how to add count or mysql_num_rows code into this query.