Jump to content

journeyman73

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

journeyman73's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. how do i clear it for get? Cheers
  2. It's post, i have attached a screen shot of the page so you can see the page and also the two includes that deal with the new bit and the list bit Cheers Kev [attachment deleted by admin]
  3. Hi i have a page that passes an url string of http://www.blah.co.uk/admin/list_links.php?upload_message=image%20uploaded&upload_message_type=success&show_image=FLSGAL23860_home.jpg when my image is uploaded. But i also have another form on this page that does not require the string, but when i submit this form the url string remains. Is there a way of clearing the string and just having http://www.torbaypoetryfestival.co.uk/admin/list_links.php when the form is submitted? I have included the code for the page. Cheers Kev [attachment deleted by admin]
  4. it's a game called skittles, bit like ten pin bowling but with only nine pins in a diamond shape here is the league's current site (being updated by me, as we speak) www.torquayskittlesleague.org.uk
  5. what i need to do is create the fixtures, basically i need to allocated dates of games to teams to play at the start of the season, i have no idea where to start looking, for coding help
  6. Hi, I need to build a script that can take data about teams in a league and create a list of fixtures based upon what night of the week they play and what division they are in, with the ability to set the season start and finish dates. Does anybody know if such a thing is around to buy or anyone know someone who could do this, or even if it is possible PM if you want to know anymore Cheers Kevin
  7. bump anyone have any ideas on this??? Kevin
  8. i have tried moving the echo out but i only get the last line of the CSV inserted into the DB <?php { mysql_query("TRUNCATE TABLE player_averages"); } // Establish database connection here mysql_select_db($database_torquay_skittles); // Data $file = '../uploads/ext005.csv'; $table = "player_averages"; // MySQL table to insert into $fields = "player_name, player_age, player_team, player_sex, player_games, player_total, player_average, player_high, player_low, player_rank"; $s = file_get_contents($file); $rs = "\n"; // Row seperator $cs = ","; // Column seperator $esc = "\\"; // Escape character $quot = "\""; // Column data encloser // Parse input $row = 0; $col = 0; $data = array(); $escape = false; $quote = false; for($i = 0; $i < strlen($s); $i++) { if(!empty($quot) && ($s{$i} == substr($quot, 0, 1)) && !$escape) { $quote = !$quote; } elseif(!empty($quot) && ($s{$i} == $esc) && !$escape) { $escape = true; } elseif(($s{$i} == $cs) && !$quote) { $col++; $escape = false; } elseif(($s{$i} == $rs) && !$quote) { $col = 0; $row++; $escape = false; } else { $data[$row][$col] .= $s{$i}; $escape = false; } } function prepare($v) { $v = is_array($v) ? array_map("prepare", $v) : addslashes(trim($v)); return $v; } // Insert the data foreach($data as $row) { $row = prepare($row); $query = "INSERT INTO ".$table." (".$fields.") VALUES ('".implode("', '", $row)."')"; } if(mysql_query($query)) { echo "<span style=\"color: green;\">Player Averages Updated</span>\r\n"; } else { echo "<span style=\"color: red;\">Failed!</span> Reason: ".mysql_error()."<br>\r\n"; } ?> Like so, so could somebody please point me in the right direction on how to fix this cheers Kevin
  9. i've changed the code a little anybody, any ideas on how to fix this <?php { mysql_query("TRUNCATE TABLE player_averages"); } // Establish database connection here mysql_select_db($database_torquay_skittles); // Data $file = '../uploads/ext005.csv'; $table = "player_averages"; // MySQL table to insert into $fields = "player_name, player_age, player_team, player_sex, player_games, player_total, player_average, player_high, player_low, player_rank"; $s = file_get_contents($file); $rs = "\n"; // Row seperator $cs = ","; // Column seperator $esc = "\\"; // Escape character $quot = "\""; // Column data encloser // Parse input $row = 0; $col = 0; $data = array(); $escape = false; $quote = false; for($i = 0; $i < strlen($s); $i++) { if(!empty($quot) && ($s{$i} == substr($quot, 0, 1)) && !$escape) { $quote = !$quote; } elseif(!empty($quot) && ($s{$i} == $esc) && !$escape) { $escape = true; } elseif(($s{$i} == $cs) && !$quote) { $col++; $escape = false; } elseif(($s{$i} == $rs) && !$quote) { $col = 0; $row++; $escape = false; } else { $data[$row][$col] .= $s{$i}; $escape = false; } } function prepare($v) { $v = is_array($v) ? array_map("prepare", $v) : addslashes(trim($v)); return $v; } // Insert the data foreach($data as $row) { $row = prepare($row); $query = "INSERT INTO ".$table." (".$fields.") VALUES ('".implode("', '", $row)."')"; if(mysql_query($query)) { echo "<span style=\"color: green;\">Player Averages Updated</span>\r\n"; } else { echo "<span style=\"color: red;\">Failed!</span> Reason: ".mysql_error()."<br>\r\n"; } } ?>
  10. at the moment it reports everytime a line is added to the db but i only want it to show it that it has finished
  11. Hi, I would like to change this code so that i only 1 report that it is successful or a failure i have tried by moving the echo out of the query, but then i only get one record inserted any ideas on how i can do it, also if possible how can i get it to report that the delete is successful as well as i get a query was empty error <?php { $deleteSQL = sprintf("DELETE FROM player_averages"); if(mysql_query($deleteSQ)) { echo "<span style=\"color: green;\">Player Averages Deleted</span>\r\n"; } else { echo "<span style=\"color: red;\">Failed!</span> Reason: ".mysql_error()."<br>\r\n"; } } // Establish database connection here mysql_select_db($database_torquay_skittles); // Data $file = '../uploads/ext005.csv'; $table = "player_averages"; // MySQL table to insert into $fields = "player_name, player_age, player_team, player_sex, player_games, player_total, player_average, player_high, player_low, player_rank"; $s = file_get_contents($file); $rs = "\n"; // Row seperator $cs = ","; // Column seperator $esc = "\\"; // Escape character $quot = "\""; // Column data encloser // Parse input $row = 0; $col = 0; $data = array(); $escape = false; $quote = false; for($i = 0; $i < strlen($s); $i++) { if(!empty($quot) && ($s{$i} == substr($quot, 0, 1)) && !$escape) { $quote = !$quote; } elseif(!empty($quot) && ($s{$i} == $esc) && !$escape) { $escape = true; } elseif(($s{$i} == $cs) && !$quote) { $col++; $escape = false; } elseif(($s{$i} == $rs) && !$quote) { $col = 0; $row++; $escape = false; } else { $data[$row][$col] .= $s{$i}; $escape = false; } } function prepare($v) { $v = is_array($v) ? array_map("prepare", $v) : addslashes(trim($v)); return $v; } // Insert the data foreach($data as $row) { $row = prepare($row); $query = "INSERT INTO ".$table." (".$fields.") VALUES ('".implode("', '", $row)."')"; if(mysql_query($query)) { echo "<span style=\"color: green;\">Player Averages Updated</span>\r\n"; } else { echo "<span style=\"color: red;\">Failed!</span> Reason: ".mysql_error()."<br>\r\n"; } } ?>
  12. yes i do have a connection script that i use from an include that is across the whole site. when i call this page i get a blank page (which i know as it has no html on it) but when i check using mysql gui tools it still shows that data still there, but if i then refresh the page the data has gone I can do it fine when i'm deleting one record from a table but i need to delete all records from the tables in one go, this has got me stumped
  13. that is all i have on a php page with no html on it at all kev
  14. but it won't delete anything unless i refresh the the page, it there a way i could do it so i don't have to refresh?
  15. I want to be able to run this when the page loads, can somebody please help me at the moment it only runs if i refresh the page when it's loaded also can this be simplified? <?php mysql_query("DELETE FROM fixtures"); mysql_query("DELETE FROM highest_alley"); mysql_query("DELETE FROM player_scores"); mysql_query("DELETE FROM player_averages"); mysql_query("DELETE FROM results"); mysql_query("DELETE FROM tables"); mysql_query("DELETE FROM team_averages"); mysql_query("DELETE FROM trophy_leaders"); ?> Cheers kev
×
×
  • 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.