Field Addition in MySQL
1 post
• Page 1 of 1
Field Addition in MySQL
I have a table that contains a field for each entry called PLD (matches played). I would like to know if it's possible to perform a query that will add all the fields together with the exception of when they're not active(0). Here's how I'm doing it at the moment:
- Code: Select all
$q1 = mysql_query("SELECT PLD FROM $table WHERE active!=0") or die (mysql_error());
while ($r1 = mysql_fetch_array($q1))
{
$matchesPlayed = $matchesPlayed + $r1[PLD];
}
echo $matchesPlayed;
1 post
• Page 1 of 1
Return to HTML, CSS, and Scripts
Who is online
Users browsing this forum: No registered users and 6 guests