bravo14
-
Posts
296 -
Joined
-
Last visited
Posts posted by bravo14
-
-
That is it, all iof the scorers for each team is in one table, but we want to total how many each person has scored for each team
-
I have atatched an image
The table below will give a sort of idea
This table is currently manually updated but I want it to pull from the db.
Name 1st Lg 1st Fr Fathom Badgers Total
Andy Pyke 7 2 7 16
Ismail Mutlib 1 11 4 16
Munib Altaf 7 5 12
Robin Stanley 11 11
Saleem Hussain 2 3 5
Abra Baig 3 3
Andy Elves 2 1 3
Sameer Hussain 3 3
Scott Oliver 3 3
Shoeb Siddiqui 2 1 3
Haseeb Altaf 3 3
Rob McGuigan 1 2 3
Luke Menzil 2 2
Ben Cross 1 1
Naveed Akram 1 1
Zach Jarvis 1 1
Jordan Allen 1 1
Jon Smith 1 1
Dave Donkin 1 1
Chris Wadhams 1 1
Glenn Sherard 1 1
Gavin Hetherington 1 1
Haider Iqbal 1 1
The MySQL table dictates the team (team_id and whether it is a league or a friendly game)
[attachment deleted by admin]
-
The table result I am after is at http://www.yardleyhc.co.uk/goalscorers.htm
-
I am trying to show who has scored and how many in the differerent team_id and league fields to highlight the top scorers
-
I am trying to recreate the table structure below using one query, not sure if it can be done
Name 1st Lg 1st Fr Fathom Badgers Total
The data is stored in one table, the sql dump is below Code: [select]CREATE TABLE IF NOT EXISTS `tbl_scorers` ( `scorer_id` int(11) NOT NULL auto_increment, `match_id` int(11) NOT NULL, `scorer` varchar(30) NOT NULL, `goals` int(11) NOT NULL, `team_id` int(11) NOT NULL, `league` varchar( NOT NULL, PRIMARY KEY (`scorer_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Table for goal scorers across the club' AUTO_INCREMENT=33 ; -- -- Dumping data for table `tbl_scorers` -- INSERT INTO `tbl_scorers` (`scorer_id`, `match_id`, `scorer`, `goals`, `team_id`, `league`) VALUES (1, 16, 'Andy Pyke', 1, 1, 'league'), (2, 14, 'Andy Elves', 1, 1, 'league'), (3, 14, 'Rob McGuigan', 1, 1, 'league'), (4, 14, 'Abrar Baig', 2, 1, 'league'), (5, 14, 'Andy Pyke', 2, 1, 'league'), (6, 25, 'Andy Pyke', 6, 2, 'friendly'), (7, 25, 'Munib Altaf', 1, 2, 'friendly'), (8, 26, 'Munib Altaf', 1, 2, 'friendly'), (9, 26, 'Ismail Mutlib', 1, 2, 'friendly'), (10, 26, 'Robin Stanley', 4, 2, 'friendly'), (11, 28, 'Luke Menzil', 1, 2, 'friendly'), (12, 28, 'Scott Oliver', 1, 2, 'friendly'), (13, 28, 'Shoeb Siddiqui', 1, 2, 'friendly'), (14, 28, 'Saleem Hussain', 1, 2, 'friendly'), (15, 30, 'Jonathan Smith', 1, 2, 'friendly'), (16, 30, 'Scott Oliver', 1, 2, 'friendly'), (17, 30, 'Robin Stanley', 1, 2, 'friendly'), (18, 30, 'Munib Altaf', 2, 2, 'friendly'), (19, 32, 'Robin Stanley', 1, 2, 'friendly'), (20, 32, 'Scott Oliver', 1, 2, 'friendly'), (21, 32, 'Ismail Mutlib', 1, 2, 'friendly'), (22, 32, 'Andy Pyke', 1, 2, 'friendly'), (23, 34, 'Luke Menzil', 1, 2, 'friendly'), (24, 34, 'Jordan Allen', 1, 2, 'friendly'), (25, 34, 'Ismail Mutlib', 2, 2, 'friendly'), (26, 34, 'Robin Stanley', 1, 2, 'friendly'), (27, 36, 'Ismail Mutlib', 4, 2, 'friendly'), (28, 36, 'Robin Stanley', 1, 2, 'friendly'), (29, 36, 'Shoeb Siddiqui', 1, 2, 'friendly'), (30, 36, 'Chris Wadhams', 1, 2, 'friendly'), (31, 36, 'Glenn Sherrard', 1, 2, 'friendly'), (32, 36, 'Gavin Hetherington', 1, 2, 'friendly');
I have tried the query below but not getting the desired result
SELECT scorer, Sum(t1.firstleague) AS firstleague, Sum(t2.firstfriendly) AS firstfriendly, Sum(t3.fathoms) AS fathoms, Sum(t4.badgers) AS badgers, Sum(goals) AS goals_scored FROM tbl_scorers LEFT JOIN (SELECT sum(goals), 1 AS firstleague FROM tbl_scorers WHERE team_id =1 and league="league") AS t1 LEFT JOIN (SELECT goals, 1 AS firstfriendly FROM tbl_scorers WHERE team_id =1 and league="friendly") AS t2 LEFT JOIN (SELECT goals, 1 AS fathoms FROM tbl_scorers WHERE team_id =2 and league="friendly") AS t3 LEFT JOIN (SELECT goals, 1 AS badgers FROM tbl_scorers WHERE team_id =3 and league="friendly") AS t4 group by scorer
-
I am trying to recreate the table structure below using one query, not sure if it can be done
The data is stored in one table, the sql dump is below
CREATE TABLE IF NOT EXISTS `tbl_scorers` ( `scorer_id` int(11) NOT NULL auto_increment, `match_id` int(11) NOT NULL, `scorer` varchar(30) NOT NULL, `goals` int(11) NOT NULL, `team_id` int(11) NOT NULL, `league` varchar( NOT NULL, PRIMARY KEY (`scorer_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Table for goal scorers across the club' AUTO_INCREMENT=33 ; -- -- Dumping data for table `tbl_scorers` -- INSERT INTO `tbl_scorers` (`scorer_id`, `match_id`, `scorer`, `goals`, `team_id`, `league`) VALUES (1, 16, 'Andy Pyke', 1, 1, 'league'), (2, 14, 'Andy Elves', 1, 1, 'league'), (3, 14, 'Rob McGuigan', 1, 1, 'league'), (4, 14, 'Abrar Baig', 2, 1, 'league'), (5, 14, 'Andy Pyke', 2, 1, 'league'), (6, 25, 'Andy Pyke', 6, 2, 'friendly'), (7, 25, 'Munib Altaf', 1, 2, 'friendly'), (8, 26, 'Munib Altaf', 1, 2, 'friendly'), (9, 26, 'Ismail Mutlib', 1, 2, 'friendly'), (10, 26, 'Robin Stanley', 4, 2, 'friendly'), (11, 28, 'Luke Menzil', 1, 2, 'friendly'), (12, 28, 'Scott Oliver', 1, 2, 'friendly'), (13, 28, 'Shoeb Siddiqui', 1, 2, 'friendly'), (14, 28, 'Saleem Hussain', 1, 2, 'friendly'), (15, 30, 'Jonathan Smith', 1, 2, 'friendly'), (16, 30, 'Scott Oliver', 1, 2, 'friendly'), (17, 30, 'Robin Stanley', 1, 2, 'friendly'), (18, 30, 'Munib Altaf', 2, 2, 'friendly'), (19, 32, 'Robin Stanley', 1, 2, 'friendly'), (20, 32, 'Scott Oliver', 1, 2, 'friendly'), (21, 32, 'Ismail Mutlib', 1, 2, 'friendly'), (22, 32, 'Andy Pyke', 1, 2, 'friendly'), (23, 34, 'Luke Menzil', 1, 2, 'friendly'), (24, 34, 'Jordan Allen', 1, 2, 'friendly'), (25, 34, 'Ismail Mutlib', 2, 2, 'friendly'), (26, 34, 'Robin Stanley', 1, 2, 'friendly'), (27, 36, 'Ismail Mutlib', 4, 2, 'friendly'), (28, 36, 'Robin Stanley', 1, 2, 'friendly'), (29, 36, 'Shoeb Siddiqui', 1, 2, 'friendly'), (30, 36, 'Chris Wadhams', 1, 2, 'friendly'), (31, 36, 'Glenn Sherrard', 1, 2, 'friendly'), (32, 36, 'Gavin Hetherington', 1, 2, 'friendly');
I have tried the query below but not getting the desired result
SELECT scorer, Sum(t1.firstleague) AS firstleague, Sum(t2.firstfriendly) AS firstfriendly, Sum(t3.fathoms) AS fathoms, Sum(t4.badgers) AS badgers, Sum(goals) AS goals_scored FROM tbl_scorers LEFT JOIN (SELECT sum(goals), 1 AS firstleague FROM tbl_scorers WHERE team_id =1 and league="league") AS t1 LEFT JOIN (SELECT goals, 1 AS firstfriendly FROM tbl_scorers WHERE team_id =1 and league="friendly") AS t2 LEFT JOIN (SELECT goals, 1 AS fathoms FROM tbl_scorers WHERE team_id =2 and league="friendly") AS t3 LEFT JOIN (SELECT goals, 1 AS badgers FROM tbl_scorers WHERE team_id =3 and league="friendly") AS t4 group by scorer
-
I have got it sorted, I had replaced $row[] in the nav menu include
silly me
-
The site is at www.projectrenovations.co.uk and click on Services or Who Are We, and you will see thre result
The menu at the top is pulled using the same query and the title is populqated using the same query.
-
This iw aht is in the code
<?php include('includes/connect.php'); $sql=("SELECT * FROM `tbl_content` WHERE `page_id` = '" . $_GET['page_id'] . "' LIMIT 1"); $result=mysql_query($sql); if(mysql_num_rows($result)==0) { die("Database problems!"); } $row = mysql_fetch_array($result); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Project Renovations | <?php echo $row['title'];?> </title> <link rel="stylesheet" href="css/template_css.css" type="text/css" /> <link rel="shortcut icon" href="images/favicon.ico" /> </head> <body> <div align="center"> <table align="center" width="600px" style="border: 2px solid #000066;" > <tr><td><table> <tr><td valign="top"> <div id="header"> <div id="nav"> <?php include_once('includes/nav_menu.php'); ?> </div> </div> </td> </tr> <tr><td align="right"> </td> <tr> <td><div id="content"> <div> <div id="maintext"> <?php echo '<pre>'; print_r($row); echo '</pre>'; ?> </div> <div id="randomgallery"> <?php include "randomimage.php"; ?> </div> </div> </div></td> </tr> </table> </tr></tr></table> </div> </body> </html>
And I am still getting a blank result
-
I have changed it a couple of times, trying a couple of things
<?php include('includes/connect.php'); ?> <?php $sql=('SELECT * FROM `tbl_content` WHERE `page_id` = \'' . $_GET['page_id'] . '\' LIMIT 1'); $result=mysql_query($sql); $row = mysql_fetch_array($result); echo(' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Project Renovations | '.$row['title'].'</title>'); ?> <link rel="stylesheet" href="css/template_css.css" type="text/css" /> <link rel="shortcut icon" href="images/favicon.ico" /> </head> <body> <div align="center"> <table align="center" width="600px" bordercolor="#000066" border="2px single" > <tr><td><table> <tr><td valign="top"> <div id="header"> <div id="nav"> <?php include_once('includes/nav_menu.php'); ?> </div> </div> </td> </tr> <tr><td align="right"> </td> <tr> <td><div id="content"> <div> <div id="maintext"> <?php echo $row["content"]; ?> </div> <div id="randomgallery"> <?php include "randomimage.php"; ?> </div> </div> </div></td> </tr> </table> </tr></tr></table> </div> </body> </html>
the text is still not displaying
-
Hii guys
the section in the code below that says
echo($row['content']);
does not display the data from the database
<?php include('includes/connect.php'); ?> <?php $sql=('SELECT * FROM `tbl_content` WHERE `page_id` = \'' . $_GET['page_id'] . '\' LIMIT 1'); $result=mysql_query($sql); while($row = mysql_fetch_array($result)) { echo(' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Project Renovations | '.$row['title'].'</title>'); } ?> <link rel="stylesheet" href="css/template_css.css" type="text/css" /> <link rel="shortcut icon" href="images/favicon.ico" /> </head> <body> <div align="center"> <table align="center" width="600px" bordercolor="#000066" border="2px single" > <tr><td><table> <tr><td valign="top"> <div id="header"> <div id="nav"> <?php include_once('includes/nav_menu.php'); ?> </div> </div> </td> </tr> <tr><td align="right"> </td> <tr> <td><div id="content"> <div> <div id="maintext"> <?php echo($row['content']); ?> </div> <div id="randomgallery"> <?php include "randomimage.php"; ?> </div> </div> </div></td> </tr> </table> </tr></tr></table> </div> </body> </html>
Where have I gone wrong?
-
Hi guys
I have the following error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/sites/yardleyhc.co.uk/public_html/bravo14/main.php on line 31
when using the following code, the database connection has already been made before this point
<?php $team = ('SELECT * FROM `tbl_team_menu` where `page` <>"main.php" and `team_id`\'' . $_GET['team_id'] . '\''); $teamresult=mysql_query($team); while($teamrow = mysql_fetch_array($teamresult)) { echo('<a href="'.$teamrow['page'].'?team_id='.$teamrow['team_id'].'"><img src="images/menu/'.$teamrow['button'].'" border="0"></a>'); } ?>
Can anyone point out where I have gone wrong?
-
The values available for the result field are Won, Drawn Lost
When the scores are added, the user adds the opposition, result (Won, Drawn, Lost) Goals for and goals against)
-
I have got the query sorted except for won, lost and drawn
SELECT Count(match_id) AS played, Sum(yardley_goals) AS goalsfor, Sum(opposition_goals) AS against, Sum(yardley_goals-opposition_goals) AS gd, Sum(points) AS pts FROM tbl_fixtures WHERE yardley_goals is not Null;
The field is stored in one field called result
Will I still be able to do this in one query or will it have to go into separate
-
Cheers guys, will work on the indentation, and have a look for the }
-
The table structure is here:
CREATE TABLE IF NOT EXISTS `tbl_fixtures` (
`match_id` tinyint(4) NOT NULL auto_increment,
`Opposition` varchar(30) NOT NULL,
`date_id` int(11) NOT NULL,
`HomeAway` varchar(4) NOT NULL,
`Result` varchar(4) default NULL,
`yardley_goals` tinyint(2) default NULL,
`opposition_goals` tinyint(2) default NULL,
`team_id` int(11) NOT NULL,
`league` varchar(1) NOT NULL,
`points` int(11) NOT NULL,
PRIMARY KEY (`match_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=81 ;
I can supply somke data if needed
-
Hi Guys
When I load the page with this code I get an error of
Parse error: syntax error, unexpected $end in /home/sites/yardleyhc.co.uk/public_html/bravo14/admin/add_report.php on line 86
<?php //Check if user is logged in session_start(); if (!isset($_SESSION['logname'])) { header ("Location: login.php"); } ?> <?php //connect to db include_once('includes/connect.php'); if ($_POST['submit_form'] == 1) { $data = mysql_real_escape_string(trim($_POST['fcktext'])); $match = ($_POST['match']); $headline = ($_POST['title']); $intro = substr ($data,0,100); // Save to the database $res = mysql_query("INSERT INTO tbl_reports (match_id, story, headline,intro) VALUES('$match','$data','$headline','$intro')"); if (!$res) die("Error saving the record! Mysql said: ".mysql_error()); // Redirect to self to get rid of the POST $message = "The scorer has been added"; } include_once "includes/fckeditor/fckeditor.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>• Yardley Hockey Club • Admin • Amend Home Page Content •</title> <link href="../style/2008.css" rel="stylesheet" type="text/css" /> </head> <body> <div align="center"> <div id="maincontent"> <div id="header"><img src="../images/logo.gif" /><img src="../images/yardley.png" /></div> <div id="maintext"> <div><a href="javascript:history.go(-1)"><img src="includes/icons/back.png" border="0" alt="Go back to Previous page" /></a></div> <?php if (isset ($message)) { echo($message); } else { echo('<form method="post" action="add_report.php">'); echo('<table>'); echo ('<tr><td><select name="match"><option>Please select Fixture</option>'); $fixtures=mysql_query('SELECT * FROM `tbl_fixture_dates` INNER JOIN `tbl_fixtures` ON `tbl_fixture_dates`.`date_id` = `tbl_fixtures`.`date_id` WHERE `tbl_fixtures`.`team_id` = \'' . $_GET['team_id'] . '\' order by match_date'); if(mysql_num_rows($fixtures)==0) echo('<option>there is no data in table..</option>'); else { while($matchrow=mysql_fetch_assoc($fixtures)) { echo "<option value=".$matchrow[match_id].">".date("d-M-Y", strtotime($matchrow[Date]))."|".$matchrow[Opposition]."</option>"; } } echo ('</select></td></tr>'); echo('<tr><td><input name="title" type="text" value="Enter Headline Here..." size="70" class="button"/></td></tr>'); echo ('<tr><td>'); $oFCKeditor = new FCKeditor('fcktext'); $oFCKeditor->BasePath = "includes/fckeditor/"; $oFCKeditor->Value = ""; $oFCKeditor->Width = 540; $oFCKeditor->Height = 400; echo $oFCKeditor->CreateHtml(); echo ('</td></tr>'); echo ('<br /> '); echo('<tr><td><input type="hidden" name="submit_form" value="1" /> </td></tr> <tr><td><input type="submit" value="Save Post" class="button"/> </td></tr> </table> </form>'); ?> </div> </div> </div> </body> </html>
Probably just missed something obvious, but can't see it
Cheers
-
Hi guys
I am trying to create a query that displays the standard league table style results from a mysql table
the query I have got is
SELECT Count (match_id) AS played, Sum(yardley_goals) AS for, Sum(opposition_goals) AS against, Sum(yardley_goals-opposition_goals) AS gd, Sum(points) AS pts FROM tbl_fixtures WHERE yardley_goals <>Null;
I am also not sure how to show how may games have bene won, drawn and lost, let me know if you need to see the table structure
The columns I want are
Played Won Drawn Lost For Against Goal Difference Points
Any help would be great
-
Thank you so much, it works a treat, is there any way in which you can comment the code so that I can se what has been done
-
At present this is how the table looks with the menu options in, if there is a better way then please let me know
menu_id menu parent_menu_id
1 Admin 0
2 1st XI 0
3 Fathoms 0
4 Badgers 0
5 Results 2
6 Reports 2
7 Committee 1
8 Selection Policy 1
There may be a better way, may be two tables, but I am not sure, any advice much appreciated
-
In dreamweaver CS3 there are some Spry items and when they get added to a page the code looks like
<ul id="MenuBar1" class="MenuBarVertical"> <li><a class="MenuBarItemSubmenu" href="#">Item 1</a> <ul> <li><a href="#">Item 1.1</a></li> <li><a href="#">Item 1.2</a></li> <li><a href="#">Item 1.3</a></li> </ul> </li> <li><a href="#">Item 2</a></li> <li><a class="MenuBarItemSubmenu" href="#">Item 3</a> <ul> <li><a class="MenuBarItemSubmenu" href="#">Item 3.1</a> <ul> <li><a href="#">Item 3.1.1</a></li> <li><a href="#">Item 3.1.2</a></li> </ul> </li> <li><a href="#">Item 3.2</a></li> <li><a href="#">Item 3.3</a></li> </ul> </li> <li><a href="#">Item 4</a></li> </ul>
-
Hi Guys
Does anybody know if it is possible to populate the Spry menus in Dreamweaver with menu items from a MySQL db.
If so would you be able to point me in the right direction.
Cheers
Mark
-
Cheers guys
I am building the page up slowly, once I have got this cracked ,the rest of the page will be determined by the result of the query.
-
Hi guys
I am trying to create a member only section of a site and display the user name at the top next to the Welcome note. The page is displaying correctly except for the user name
<? session_start(); if (!isset($_SESSION['logname'])) { header ("Location: login.php"); } else { echo'<html>'; echo'<head>'; echo'<title>• Yardley Hockey Club • Admin • Control Panel •</title>'; echo'<link href="../style/2008.css" rel="stylesheet" type="text/css" />'; echo'</head>'; echo'<body>'; echo'<div id="maintext">'; include_once('includes/connector.php'); $logname=$_SESSION['logname']; $sql = "SELECT * FROM `tbl_admin_users` where username ='$logname'"; $result=mysql_query($sql); while($row = mysql_fetch_array($result)); echo('Welcome ' .$row[username].'.'); include_once('includes/9.php'); } ?> </div> </body> </html>
I know that someone out there can help
[SOLVED] Goalscorers from one table and one query
in MySQL Help
Posted
I put the following query in and got an error of
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS firstleague,
Sum(IF(team_id =1 and league="friendly",1,0) AS firstfriendly,
' at line 3
so added some brackets in and got the folowing
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from `tbl_scorers`
group by scorer' at line 7 with the following query
any ideas?