LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-31-2004, 11:24 PM   #1
Gerardoj
Member
 
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465

Rep: Reputation: 30
PHP & MySQL Count on PHP


Hi All. I would some help on displaying on HTML and creating the SELECT.

I have 2 tables and I would like to store on a variable the result of count how many users are on every Division.

I know I can do it as:

SELECT Count(*) FROM MisEquipos WHERE campoalt = 58;

But How can I do the SELECT on PHP, displaying the results of the count of every division on a simple table??

Would be great if someone could help me out..

Code:
mysql> SELECT * FROM Divisions;
+-----+----------+------------+--------------+----------+
| lid | equipoID | createdate | divisionname | password |
+-----+----------+------------+--------------+----------+
|  22 |       58 | 2004-05-28 | Primera      |          |
|  23 |       59 | 2004-05-28 | Second      |          |
+-----+----------+------------+--------------+----------+
1 row in set (0.01 sec)
 
mysql> SELECT * FROM MisEquipos;
+-----+-------------+----------+------------+------------+----------+
| lid | campeonatos | username | equipo     | createdate | campoalt |
+-----+-------------+----------+------------+------------+----------+
|  62 |           1 | jukio    | Jukialn    | 2004-05-29 | 58       |
|  61 |           1 | picciotd | Piccio     | 2004-05-29 | 58       |
|  60 |           1 | gery     | GeryRivera | 2004-05-28 | 58       |
|  59 |           1 | admin    | Gerardo    | 2004-05-28 | 59       |
|  58 |           1 | r0ot     | r0oting    | 2004-05-28 | 59       |
+-----+-------------+----------+------------+------------+----------+

Last edited by Gerardoj; 05-31-2004 at 11:26 PM.
 
Old 06-01-2004, 10:43 AM   #2
flakzeus
Member
 
Registered: Jan 2004
Location: Salisbury, NC
Distribution: Gentoo 2004.1
Posts: 48

Rep: Reputation: 15
If you already have the SQL statement made then all you have to do is execute it in PHP

PHP Code:
// Set the SQL Statement
$sql "SELECT Count(*) FROM MisEquipos WHERE campoalt = 58"
// Execute it
$resutl mysql_query($sql$connection); 
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Slackware guide for AMP Apache MySQL & PHP xushi Slackware 35 05-11-2006 11:18 AM
PHP & Mysql Authentication Savahn Programming 0 03-14-2005 01:22 PM
PHP 4.3.8 & MySQL 4.1.7 MonServeur Linux - Software 0 11-21-2004 07:18 PM
From RedHat9 to FreeBSD (Apache 2 & Mysql & PHP 4) guardian653 *BSD 5 12-11-2003 05:31 PM
mysql & php minor Programming 4 11-14-2002 04:58 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration