Page 1 of 1

Football tables

Posted: Wed Jan 19, 2005 9:38 am
by jetpacmidge
Hi,

I am creating an interactive website where an administrator enters the football results which automatically updates the tables.
I am using MYSQL, PHP and Apache webserver which I am a new user.

So far i have created the tables and managed to in 8O put results into the database but am stuck in how to show the updated tables each time a result is entered.

Copy of creating tables script.

create database Tadburnfc;
#use Tadburnfc;
#show databases;
#show tables;
use Tadburnfc;
#drop table results;
#drop table leagueTable;
create table results (
season CHAR(10) NOT NULL,
age CHAR(15) NOT NULL,
homeTeam CHAR(30) NOT NULL,
awayTeam CHAR(30) NOT NULL,
fixtureDate DATE NOT NULL,
homeScore INT(3) UNSIGNED NOT NULL,
awayScore INT(3) UNSIGNED NOT NULL,
PRIMARY KEY(season, age, homeTeam, awayTeam) );
create table leagueTable (
season CHAR(10) NOT NULL,
age CHAR(15) NOT NULL,
team CHAR(30) NOT NULL,
played INT(4) UNSIGNED NOT NULL,
won INT(4) UNSIGNED NOT NULL,
lost INT(4) UNSIGNED NOT NULL,
drawn INT(4) NOT NULL,
goalsfor VARCHAR(4) NOT NULL,
goalsagainst VARCHAR(4) NOT NULL,
points INT(3) NOT NULL,
PRIMARY KEY(season, age, team) );
show tables;
describe results;
describe leagueTable;

Any help in how to show the updated tables on the website would be much appreciated.
Thanks.

If someone could point me in the right direction on the PHP code to use for example I would be grateful.

Thanks for any help to my problem.

Rgds,

Andy M

Posted: Wed Jan 19, 2005 9:42 am
by feyd
showing a given table's contents is most often, a simple SELECT command.

You may want to read some tutorials about MySQL SELECTS, including our own in the tutorial section.

Re: Football tables

Posted: Wed Jan 19, 2005 1:42 pm
by JAM
jetpacmidge wrote:If someone could point me in the right direction on the PHP code to use for example I would be grateful.
What feyd sais, and adding that I'd also recommend the PHP manual and not to forget, it's usercomments.
mysql_fetch_array() is a very place to start, but the rest of the MySQL php functions should not be forgotten.