Re: Need Help : Addition of multiple table rows
| From: | Jayme Jeffman Filho | Date: | Fri, 01 Sep 2000 20:57:29 +0000 |
| Subject: | Re: Need Help : Addition of multiple table rows | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-2574@lists.php.net to get a copy of this message | ||
Try a join : "select Artical.Points, Lesson.Points from Artical, Lesson
where UserId = $user" , and sum the results .
I hope this helps.
Jayme.
-----Mensagem Original-----
De: Jeremy <sparhawk@cleanweb.net>
Para: <php-db@lists.php.net>
Enviada em: sexta-feira, 1 de setembro de 2000 17:41
Assunto: [PHP-DB] Need Help : Addition of multiple table rows
I am making a site where members are acredited points for submitting
something (ex. Article, Lesson, etc) Whenever their name is displayed on the
site, I want to have the number of points the user has in parenthesis.
ex . Jeremy F (234)
The problem is : I have several different resources that can be submitted in
different tables ( Lessons, Articles, Reviews, etc) This is done because the
content of each resource is unique. In each resource table for a submission
I will have a UserID (the person who subitted the resource)
Is there anyway I can make a new table that has columns
UserID (member)
LessonPoints (number of points from lessons)
ReviewPoints (number of points from lessons)
The php script that displays the points would add these two variables to get
the number of points. However, how do I set it up so that LessonPoints
counts the instances of a UserID in the Lesson Table?
Or should I do all of this through php?