PDA

View Full Version : Help...



e5
20-01-2011, 05:11 PM
Well basically on our sporting website, I am looking to add a thing on the front page where it shows someones name and how many goals they've scored...

I've seen them before... an example I want is like this: http://www.brhc.co.uk/ - On their front page they have a "top scorers" thing... I am looking to see if I could have one of these created for me so I could put it on our website?

We have 4 teams at our club, and i'd like one for each team...

Anyone that could create one.. i'm hoping they're simple? would be fantastic.

Thanks.

coolchris322
20-01-2011, 05:39 PM
easy system, just create a table, with 4 rows, set the table to have 2 columns, team name and score.

then just add the scores into that, and do the query "select * from `tbl_name` sort desc by score" and then just do mysql_fetch_array for that, and it will just order it out :D simple as.

e5
22-01-2011, 02:39 PM
do i do all that coding stuff on the site?

coolchris322
22-01-2011, 07:32 PM
Yeh.

If you dont know how to do that, just pm me ingame, and im shure i could sort something out.

e5
23-01-2011, 06:22 PM
Cheers for your help mate. +rep.

coolchris322
23-01-2011, 08:11 PM
gimi 2 mins, ill just post sql and php code

---------- Post added 23-01-2011 at 08:14 PM ----------

sql : just run this in your sql and it will create the tables needed

CREATE TABLE IF NOT EXISTS `scores`(
`team` text NOT NULL,
`score` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;

e5
23-01-2011, 08:17 PM
Cheers for all your help :)

coolchris322
23-01-2011, 08:19 PM
The php source:

<?
$host = "localhost";
$username = "USER";
$password = "PASS";
$database = "DATABASEl";
mysql_connect("$host", "$username", "$password")or die("cannot connect server");
mysql_select_db("$database")or die("cannot select DB");
$sql = mysql_query("SELECT * from `scores`");
echo "<table><tr><td>Team</td><td>Score</td><tr>"
while($r = mysql_fetch_array($sql)) {
echo "<tr><td>."$r['team']."</td><td>".$r['score'];
}
?>

---------- Post added 23-01-2011 at 08:20 PM ----------

should echo all the teams within the database for each row, echo the team name and their score.

just go into the db and edit their scores, or build a script that updates it.

e5
24-01-2011, 09:32 AM
Is there a place where I could test this but not on the website? :P

coolchris322
26-01-2011, 07:56 AM
just create a php page on the website and dont give anyone the link - should make it a kind of private testing place.

Want to hide these adverts? Register an account for free!