Jump to content

Recommended Posts

Player

Name

Total
Ballots Regular
Ballots Bonus
Ballots Singles
Games Pards
Games Single's
Pawns Single's
Scores Pards
Pawns Pards
Scores Singles
4s Pards
7s Total
Games Total
Pawns Total
Score

xtaz2002x 2 2 0 0 0 2 220 3 291 0 0 2 5 511

Woman 3 3 0 0 0 4 288 4 405 1 0 2 8 693

 

 

the ballot numbers will be generated at end of event but what i need to know if there is anyway that with
this data i can  either in a php page or a mysql query set it up so that for each player  will insert the number of ballots on multiple rows in my ballot table which will have 

id  playername  BallotNumber

 

what my desired output is  from the data above

 

1    xtaz2002x    10000

2    xtaz2002x    10001

3    xtaz2002x    10002

4    Woman        10003

5    Woman        10004

Just need to know where i can start with if this is even possible

Edited by Justafriend

If you're asking whether you can insert 3 times for someone that has 3 ballots, that sounds like a bad idea. If it's not, then I don't understand the question.

yes i am i need  to do a final  and will be done on a  page i upload or in a sql script i run once 

The reason to be more clear is i need one entry  for each ballot  in ballot table 

The regular ballots i could do easily but the bonus Ballots gets a little more trickier 

They are calculated by 

1 Ballot for Every 5 Games in Singles with a 4 score

1 Ballot for every 3 Games in Pards with a team score of 7

1 Ballot for Every 500 pts Combined in Single games

1 Ballot for Every 1000 pts Combined team score in Pards Games

if i did a  insert for every 5 games where  score = 4  at  game 5 6 7 8 9 it would insert a total of 5 when it should be 1

i included a link to the table its based on so you can see  a better idea of what i am doing

http://whambamgames.com/teststuff/pawn/players.php

 

the issue with writing code to start is i have no clue where to even start if its even possible 

Just thinking about it further even if i could get  it to echo out into html text where it would show it i could then put into a excel sheet  then save it as a csv and import 

the select statement i  have in my php  is

   $sql = "SELECT PlayerName, COUNT(*) AS TG, SUM(sg) AS SG, SUM(pg) AS PG, SUM(PlayerPawn) AS PP, SUM(PlayerScore) AS PS, SUM(PPlayerPawn) AS PPP,
   SUM(PPlayerScore) AS PPS, SUM(PPlayerPawn + PlayerPawn) AS TP, SUM(PPlayerScore + PlayerScore) AS TS, SUM(S4) AS SS4, SUM(P7) AS PP7, 
  floor(SUM(PlayerScore /500)) + floor(SUM(PPlayerScore /1000)) + floor(SUM(S4 /5)) +  floor(Sum(P7 /3)) + SUM(prereg) AS BB,  floor(SUM(PlayerScore /500)) + floor(SUM(PPlayerScore /1000)) +  floor(SUM(S4 /5)) +  floor(Sum(P7 /3)) + SUM(PlayerBallots) + SUM(prereg) AS TB,
   SUM(PlayerBallots) AS PB FROM player GROUP BY PlayerName ";

what i need is that whatever Tb is to echo out the player name  that many times  so if TB is 5 for player woman it would echo on a page

woman

woman

woman

woman

woman

I have tried to see if i can get it to output to a webpage so i can bring it into excel before importing it to avoid dangerous results

with the code below i am getting

Parse error: syntax error, unexpected 'str_repeat' (T_STRING) in /home2/whambamg/public_html/teststuff/pawn/test.php on line 20

<!DOCTYPE html>
<html>

<?php
   include("config.php");
   $sql = "SELECT PlayerName, 
   floor(SUM(PlayerScore /500)) + 
   floor(SUM(PPlayerScore /1000)) +  
   floor(SUM(S4 /5)) +  floor(Sum(P7 /3)) + 
   SUM(PlayerBallots) + 
   SUM(prereg) AS TB,
   SUM(PlayerBallots) AS PB FROM player GROUP BY PlayerName ";
if($result = mysqli_query($con, $sql)){
   
$input = $row['PlayerName'];
  
$multiplier = $row['TB'];
   
   
string str_repeat ( string $input , int $multiplier );


 
// Close connection
mysqli_close($con);



?>

	</html>

I believe this will give you a better idea of what i am trying to do

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.