Jump to content

j4ymf

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Everything posted by j4ymf

  1. a friend come to my help, this is how we ended up! $sql = "SELECT a.id, a.name, a.team, a.price, a.points, c.NEW_POINTS, "; $sql .= "IF (c.NEW_POINTS IS NOT NULL , a.points - c.NEW_POINTS, a.points) AS 'REAL_TOTAL', "; $sql .= "IF (c.NEW_POINTS IS NOT NULL, 'SUB', 'NOTSUB') AS 'SUBQ' "; $sql .= "FROM teams b"; $sql .= " INNER JOIN dreamteam a "; $sql .= " ON a.id IN ("; $sql .= " b.player_1, b.player_2, b.player_3, b.player_4, b.player_5, "; $sql .= " b.player_6, b.player_7, b.player_8, b.player_9, b.player_10, b.player_11) "; $sql .= " LEFT OUTER JOIN subs2 c ON c.NEW_ID = a.ID AND b.team_name = c.team_name "; $sql .= "WHERE b.team_name = '$teamname' "; $sql .= "ORDER BY a.id" thanks for everyones help today - jason
  2. some one else has told me to turn these around which has got rid of the error but it still cant build the table! $sql .= "WHERE b.team_name = '$teamname' "; $sql .= "AND b.team_name = c.team_name "; confusing it has worked for so long until now!
  3. thankyou SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; CREATE TABLE teams ( TEAM_NAME varchar(50) collate latin1_general_ci NOT NULL default '', TEAM_ADMIN int(2) NOT NULL default '0', PLAYER_1 int(3) NOT NULL default '0', PLAYER_2 int(3) NOT NULL default '0', PLAYER_3 int(3) NOT NULL default '0', PLAYER_4 int(3) NOT NULL default '0', PLAYER_5 int(3) NOT NULL default '0', PLAYER_6 int(3) NOT NULL default '0', PLAYER_7 int(3) NOT NULL default '0', PLAYER_8 int(3) NOT NULL default '0', PLAYER_9 int(3) NOT NULL default '0', PLAYER_10 int(3) NOT NULL default '0', PLAYER_11 int(3) NOT NULL default '0', PRIMARY KEY (TEAM_NAME) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
  4. hello yes i do have a column called team_names in my teams table. in my editor the text is red on this line $sql = "SELECT a.id, a.name, a.team, a.price, a.points, c.NEW_POINTS, "; thank you for your time jason
  5. hello this is my site this is my error page http://www.manninglevels.co.uk/ccompare_teams1.php
  6. thank you joul this is what i get now Error when building the team league table! (function 2) Unknown column 'b.team_name' in 'on clause'
  7. thankyou its saying Error when building the team league table! (function 2)
  8. Hello i have been running a fantasy football site for 7 years with this code but it is failing now with an error, Why! can anyone please help because its been so long since ive used php <?php function build_league_table($teamname) { $connection = mysql_connect($host, $user,$password) or die ("Couldn't connect to server."); $db = mysql_select_db($database, $connection) or die ("Couldn't select database."); $sql = "SELECT a.id, a.name, a.team, a.price, a.points, c.NEW_POINTS, "; $sql .= "IF (c.NEW_POINTS IS NOT NULL , a.points - c.NEW_POINTS, a.points) AS 'REAL_TOTAL', "; $sql .= "IF (c.NEW_POINTS IS NOT NULL, 'SUB', 'NOTSUB') AS 'SUBQ' "; $sql .= "FROM teams b, dreamteam a "; $sql .= "LEFT OUTER JOIN subs2 c ON c.NEW_ID = a.ID "; $sql .= "AND b.team_name = c.team_name "; $sql .= "WHERE b.team_name = '$teamname' "; $sql .= "AND a.id "; $sql .= "IN (b.player_1, b.player_2, b.player_3, b.player_4, b.player_5, "; $sql .= "b.player_6, b.player_7, b.player_8, b.player_9, b.player_10, b.player_11) "; $sql .= "ORDER BY a.id "; // change to .team $result = mysql_query($sql) or die ("Error when building the team league table! (function 2)"); if ($myrow = mysql_fetch_array($result)){ many thanks jason
  9. hello i running a fantasy world cup football site and its been along while since ive been dabbling with php i have this bit of code that check if i have more than 2 players from the same team. i need to update it so it check to see if i have at least 1 England player aswell. can you please help as i have forgot how to do it. thanks jason while ($check = mysql_fetch_assoc($result)) { if ($check['NUMBER'] > 2) { global $bad_team; $bad_team = $check['TEAM']; return False; } } return True; }
  10. hello daniel thanks for getting back to me, can you send an example, because im still stuck. can you re do my code so i can see what you mean thanks jason
  11. hello folks its been some time since ive used php, but in starting to play again. ive got this function and i want to be able to use the $totaltally else where as well so i need to call the function early, but ive forgot where to put the call function. can you please help thanks jason //.....///.......///.........////........../////........///....../////............////.............. function check_team_totaltally($player_1, $player_2, $player_3, $player_4, $player_5, $player_6, $player_7, $player_8, $player_9, $player_10, $player_11) { include("passwords.inc"); $connection = mysql_connect($host, $user,$password) or die ("Couldn't connect to server."); $db = mysql_select_db($database, $connection) or die ("Couldn't select database."); $query = "SELECT sum(price) 'total' "; $query .= "FROM dreamteam "; $query .= "WHERE dreamteam.id "; $query .= "IN ('$player_1', '$player_2', '$player_3', '$player_4', '$player_5', '$player_6', '$player_7', '$player_8', '$player_9', '$player_10', '$player_11')"; // echo "<p>check_team_total() >>> " . $query . "<p>"; //(remove the // ehen checking for errors) $result = mysql_query($query) or die ("<font color='#ffff00' size='4'>Error! checking your team total! (3)"); $total = mysql_fetch_assoc($result); if ($total1['total'] > 50) { // change to 40 for normal seasons 50 for the world cup global $totaltally; $totaltally = $total1['total']; return False; } else { return True; } $returnValue = check_team_totaltally($player_1,$player_2,$player_3,$player_4,$player_5,$player_6,$player_7,$player_8,$player_9,$player_10,$player_11); echo " $totaltally " ; } //.....///.......///.........////........../////........///....../////............////..............
  12. many thanks mikesta707 that works great, but i will have a read of idougherty post as well thanks jason
  13. thankyou i have a read then ill be back
  14. hello folks i run a fantasy football website. i have this query at the moment and all ive been doing is updating the points. but now i want to update the teams and the player names. // Check the 'dreamteam' table for the Player ID $sql = "SELECT id FROM dreamteam WHERE id = '$player_id'"; $result = mysql_query($sql) or die("Error 02: Failed to check Player ID"); if ($found = mysql_fetch_assoc($result)) { // If the player exists, update the points and update flag $sql = "UPDATE dreamteam SET points = $player_points, UPDATE_FLAG = 'Y' WHERE id = '$player_id'"; //echo "<P>@@@: " . $sql; $update = mysql_query($sql) or die("Error 03: Failed to update Player $player_id"); } else { i tried this but it cant be the right way to do it // Check the 'dreamteam' table for the Player ID $sql = "SELECT id FROM dreamteam WHERE id = '$player_id'"; $result = mysql_query($sql) or die("Error 02: Failed to check Player ID"); if ($found = mysql_fetch_assoc($result)) { // If the player exists, update the points and update flag $sql = "UPDATE dreamteam SET points = $player_points, UPDATE_FLAG = 'Y' WHERE id = '$player_id'"; $sql .= "UPDATE dreamteam SET name = $player_name, UPDATE_FLAG = 'Y' WHERE id = '$player_id'"; $sql .= "UPDATE dreamteam SET team = $player_team, UPDATE_FLAG = 'Y' WHERE id = '$player_id'"; //echo "<P>@@@: " . $sql; $update = mysql_query($sql) or die("Error 03: Failed to update Player $player_id"); } else { please point me in the right direction many thanks jason
  15. thankyou mark you are a star, just what i neeeded
  16. Sorry i will try to explain well im trying to check if the team has any duplicates, so i have 11 players being entered, but at the moment it lets the team through when you are entering it, even if i have two players the same. so im trying to avoid terry being put in twice!!! does that make sence so im after the code to check if it has any duplicates in it, thanks j4ymf jason
  17. hello all im trying to get an array to work but i just cant do it. my aim is, im running a fantasy football site and i don't want people to be able to add the same player in twice. how would i go about doing it? this is what i have and it dosen't work many thanks j4ymf function check_player_ids ($player_1, $player_2, $player_3, $player_4, $player_5, $player_6, $player_7, $player_8, $player_9, $player_10, $player_11) { //Put the players into an array $chosen_players = array($player_1, $player_2, $player_3, $player_4, $player_5, $player_6, $player_7, $player_8, $player_9, $player_10, $player_11); //Remove duplicates $unique_players = array_unique($chosen_players); //Compare the before and after to get any duplicates out $duplicate_players = array_diff($chosen_players, $unique_players); //Now check if there are any duplicates if (count($duplicate_players) > 0) { global $bad_player; $bad_player = $duplicate_players[0]; // only returns the first duplicate, but could be modified to return then all return False; } else { return True; } }
  18. hello amtran in the function it it used for adding up the total and checking if its not above 50 i would like to be able to use it within the same file just call back the total and use it out side that function if you get what i mean. jason
  19. thanks amtram im not sure what i need!! im looking for some help i need to able to use the value of $total some where else so whats my best way to do it? jason
  20. hello folks its been along time since iv'e been on here, but iv'e just start playing with php again and i would like some help please. // *-----------------------------------------------------------* // * check_team_total() * // * * // * Makes sure that no dreamteam has a value of more than * // * £50 million * // *-----------------------------------------------------------* function check_team_total($player_1, $player_2, $player_3, $player_4, $player_5, $player_6, $player_7, $player_8, $player_9, $player_10, $player_11) { include("passwords.inc"); $connection = mysql_connect($host, $user,$password) or die ("Couldn't connect to server."); $db = mysql_select_db($database, $connection) or die ("Couldn't select database."); $query = "SELECT sum(price) 'total' "; $query .= "FROM dreamteam "; $query .= "WHERE dreamteam.id "; $query .= "IN ('$player_1', '$player_2', '$player_3', '$player_4', '$player_5', '$player_6', '$player_7', '$player_8', '$player_9', '$player_10', '$player_11')"; $result = mysql_query($query) or die ("<font color='#ffff00' size='4'>Error! checking your team total! (3)"); $total = mysql_fetch_assoc($result); if ($total['total'] > 50) { // change to 40 for normal seasons 50 for the world cup global $truetotal; $truetotal = $total; return False; } else { return True; } } i need to be able to use $truetotal as a global so i can pull it in a few places.ive added this but i cant get it to work, global $truetotal; $truetotal = $total; please could you get me started again many thanks jason
  21. hello all im after some direction on where to look or whats its called. ive got a counter that says i have 10 people online, what i would like to do is know who is online and what page they are looking at? i haven't got a login page either so i might only have ips to work with...... please help jason
  22. thankyou very much for your help
  23. hello ive got round it [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]echo date('G:i a', strtotime('+1 hour'));[!--colorc--][/span][!--/colorc--] so do i need to ask my host where there server is based, if it is in the uk it should do its self am i right? this is the reply i got from my server Our servers, like practically all other internet servers, run on UTC/GMT. If you wish your site to display the time in British Summer Time, you will need to adjust your script. so what does this mean??
  24. [!--quoteo(post=359742:date=Mar 29 2006, 05:53 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Mar 29 2006, 05:53 PM) [snapback]359742[/snapback][/div][div class=\'quotemain\'][!--quotec--] You're going to have to use the mktime() function to add an hour. However, I suggest you figure out something in terms of server configuration otherwise you'll have problems when the time changes back. [/quote] thankyou i will look into it
  25. hello i use this code [b] [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]$now = date("G:i a");[!--colorc--][/span][!--/colorc--][/b] but because the clocks have changed the time i am showing is an hour wrong any ideas? can i do somthing like G+1 thanks jason
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.