Aravinthan
-
Posts
162 -
Joined
-
Last visited
Never
Posts posted by Aravinthan
-
-
-
Hi,
I am running a fantasy league and I was wondering how is it possible to calculate the chances of a team to make it to the playoffs?
There is 10 teams and the top 8 will make it to the playoffs.
Thank you,
Ara
-
There is more than 50 pictures...
And I am still adding pictures... That would be really tough to have them all in the same page...
-
The pictures is too big. The pictures vary from 1600x1200 to 800x600 so placing them in the dropbox would not fit into the design...
-
Hey guys,
Ok so here is what I need to do. I have a ofrm where users select images. But the thing is, I want to show the images in a different page ( sort of a gallery ) and when the users cliks on the image they want and confirm the picture, I want the file name to be written in a textbox in a PHP form to be submitted into a DB.
I can do the gallery part and the form and all...
All I need is a way for me to send the picture's name and extension to the textbox of the form.
Thanks for your help,
Ara
-
Hi guys,
I have a little problem.
So I want to order a table in a specific way.
So I started building my code:
$result = mysql_query("SELECT * FROM `teams` Order by ((`nhl_wins` *2) + `nhl_ot`) DESC",$link); while($row = mysql_fetch_array($result)) { if ($class == "class='odd'") { // this will rotate the value. $class = ""; }else{ $class = "class='odd'"; } // Moyenne Offensive $off = mysql_query("SELECT ROUND(AVG(`OFF`),2) AS `avgo` FROM teams JOIN players ON teams.id = players.team WHERE team='$row['team_name']'",$link); while($rowoff = mysql_fetch_array($off)) { $offe = "" .$rowoff['avgo']. ""; $offe = $offe / 10; } // Moyenne Defensive $def = mysql_query("SELECT ROUND(AVG(`DEF`),2) AS `avgd` FROM teams JOIN players ON teams.id = players.team WHERE team='$row['team_name']'",$link); while($rowoff = mysql_fetch_array($def)) { $defe = "" .$rowoff['avgf']. ""; $defe = $defe / 10; } // Moyenne Gardien $ga = mysql_query("SELECT ROUND(AVG(`OA`),2) AS `avgo` FROM teams JOIN players ON teams.id = players.team WHERE team='$row['team_name']' AND main_position ='1'",$link); while($rowoff = mysql_fetch_array($ga)) { $gar = "" .$rowoff['avgo']. ""; $gar = $gar / 10; } // Moyenne Generale $moyge = (round((($off + $def + $gar) / 3),2)) * 2; // Le reste $team = "" .$row['team_name']. ""; $gp = "" .$row['nhl_games_played']. ""; $wins = "" .$row['nhl_wins']. ""; $ot = "" .$row['nhl_ot']. ""; $loss = "" .$row['nhl_loss']. ""; $team = str_replace(" ", "", $team); $pts = (($wins * 2) + $ot) / 3.28; $winp = ((($ot * 0.5) + $wins) / $gp) * 100; $winp = round($winp, 2); $last10 = "" .$row['nhl_last10']. ""; $lwin = substr_count($last10, "W"); $lloss = substr_count($last10, "L"); $lot = substr_count($last10, "O"); $ltpo = (($wins * 2) + $ot) * 1.5; $total = $moyege + $pts + $ltpo;
But its only after that I realised that it woudn't work. Because I want it to be ordered by the variable $total.....
Can someone help me please? I want it to order by $total, but I dont know how...
Thanks for your help,
Ara
-
So I have changed it a bit and here is what I have:
SELECT SUM(but) AS but, SUM(assist1) AS assist1, SUM(assist2) AS assist2 FROM boxscore WHERE `but` = '$nom' OR `assist1` = '$nom' OR `assist2` = '$nom' GROUP BY `gameid` ORDER BY `gameid` LIMIT 0,3
But it shows the 3 last games when the player had a point, I want it to show 0, if a player didnt a goal or an assist in the last game....
-
-
Hi guys,
I have a question.
Ok so I have a table named boxscore.
Here is the table's structure:
`periode` int(5) NOT NULL,
`temps` varchar(50) NOT NULL,
`but` varchar(100) NOT NULL,
`assist1` varchar(100) NOT NULL,
`assist2` varchar(100) NOT NULL,
`extra` varchar(5) NOT NULL,
`gameid` int(10) NOT NULL
And some records:
(2, '06:32', 'John Ioannis', 'Sevag', 'Alex', '', 3),
(2, '14:21', 'Karl', 'Sevag', 'John Ioannis', '', 3),
(2, '06:32', 'John Ioannis', 'Sevag', 'Alex', '', 3),
(2, '14:21', 'Karl', 'Sevag', 'John Ioannis', '', 3),
(1, '08:32', 'Alex', '', '', '', 4),
(2, '06:37', 'Nicolas', 'Karl', 'Gino', '', 4),
(1, '07:32', 'Alexis', 'Aravinthan', '', '', 1),
(2, '11:38', 'Nicolas', 'John Ioannis', '', '', 1),
(3, '01:15', 'Alexis', 'Aravinthan', '', '', 1),
(3, '01:28', 'Alex', '', '', '', 1),
(3, '05:36', 'Alex', 'Nicolas', 'Gino', '', 1),
(3, '09:30', 'Alex', '', '', '', 1),
(1, '00:54', 'Nicolas', '', '', '', 2),
(1, '02:40', 'Nicolas', 'Alex', 'Jonathan', '', 2),
(1, '09:49', 'Nicolas', 'Gino', 'Steve', '', 2),
(1, '10:36', 'Nicolas', '', '', '', 2),
(2, '01:40', 'Laurent', 'Alexis', 'Aravinthan', '', 2),
(2, '03:04', 'Nicolas', 'Alex', 'Steve', '', 2),
(1, '13:09', 'Alex', 'Laurent', 'Alexis', '', 5),
(2, '07:56', 'Nicolas', 'Aravinthan', '', '', 5),
(2, '12:30', 'Nicolas', 'Karl', '', '', 5),
(3, '03:35', 'Jonathan', 'Alexis', '', '', 5);
So What I want to do, is count how many times a player has scored in the last 3 games. So the last three games id's are 5,4,3.
I have this:
SELECT * FROM boxscore WHERE `but` = '$nom' OR `assist1` = '$nom' OR `assist2` = '$nom' ORDER BY `gameid` LIMIT 0,3
But it selects only the rows where the player has a goal, or an assist....
Thank you for your help,
Ara
-
Of course....
Lol I cant beleive I asked you that question...
Thanks daniel....
Seriously what was going on in my head
-
Ahhhh... tought something like that could be making this...
But is there a work-around?
-
Hi guys,
I have a problem and I dont know why it aint working.
Ok so, I have a page named step2.php
Which is the form that sends datas to the page named step3.php
Here is the code of step2.php:
$x = 1; if ($receveur == 'Express Mistral') { $express_goals = $receveur_goals; $express_pun = $receveur_pun; } else if ($visiteur == 'Express Mistral') { $express_goals = $visiteur_goals; $express_pun = $visiteur_pun; } echo "<form action='step3.php' method='post' >"; echo "<table>"; echo "<thead>"; echo "<tr>"; echo "<th>Période</th><th>Temps</th><th>But</th><th>Assist</th><th>Assist</th><th>Extra(BN,DN,FO)</th>"; echo "</tr>"; echo "<tfoot><tr><td colspan='6'> </td></tr></tfoot>"; while ($express_goals >= $x) { echo "<tr><td><input type='textbox' name='periode_$x' /></td>"; echo "<td><input type='textbox' name='time_$x' /></td>"; echo "<td><select name='goal_$x' >"; $result = mysql_query("SELECT * FROM players ",$link); while($row = mysql_fetch_array($result)) { echo "<option value='" .$row['prenom']. "'>" .$row['prenom']. "</option>"; } echo "</td>"; echo "<td><select name='assist1_$x' >"; $result = mysql_query("SELECT * FROM players ",$link); while($row = mysql_fetch_array($result)) { echo "<option value='" .$row['prenom']. "'>" .$row['prenom']. "</option>"; } echo "<option value=''>Aucun</option>"; echo "</td>"; echo "<td><select name='assist2_$x' >"; $result = mysql_query("SELECT * FROM players ",$link); while($row = mysql_fetch_array($result)) { echo "<option value='" .$row['prenom']. "'>" .$row['prenom']. "</option>"; } echo "<option value=''>Aucun</option>"; echo "</td>"; echo "<td><input type='textbox' name='extra_$x' /></td></tr>"; $x++; } echo "</table>"; echo "<input type='hidden' name='goals' value='$express_goals' />"; echo "<input type='hidden' name='pun' value='$express_pun' />"; echo "<input type='hidden' name='gameid' value='$gameid' />"; echo "<input type='submit' value='Continuer' />"; echo "</form>";
And here is the code for step3.php:
$gameid = $_POST['gameid']; $express_goals = $_POST['goals']; $express_pun = $_POST['pun']; $x = 1; while($express_goals >= $x) { $periode = $_POST['periode_$x']; $time = $_POST['time_$x']; $goal = $_POST['goal_$x']; $assist1 = $_POST['assist1_$x']; $assist2 = $_POST['assist2_$x']; $extra = $_POST['extra_$x']; mysql_query("INSERT INTO `boxscore` (periode, temps, but, assist1, assist2, extra, gameid) VALUES ('$periode', '$time', '$goal', '$assist1', '$assist2', '$extra', '$gameid')",$link); echo "$goal"; echo "$x"; $x++; }
But for some reason, There is no data inserted and the $goal doesnt show anything.
But the $x shows the numbers. Furthermore, When I change this to: $_POST['goal_$x']; to $_POST['goal_1'];
It shows the name of the player...
Any idea why $x is not working? And is there a way of inserting it?
-
You mean that I explode my files using line breaks, and then I put them in a while loop to run 1 line at a time?
-
So I put set_time_limit(20) before my script?
-
Hi guys,
Ok so I tried this for almsot a week and I give up..
I have a MYSQL table that has this structure:
id | team1 | team2 | Team2Acc | players1 | players2 | status | accepted | rejected |
And a exemple of a value:
11 | New Jersey Devils | St.Louis Blues |Accepter |Peter%20Delmas, | 1 Phoenix Coyotes 2010, |En Attente | , Buffalo Sabres, Florida Panthers, Calgary Flames| |
I have a code that splits that splits each players 1 with a comma and inserts it into a row. The same thign for the players 2 colum. When there is 1 player, it is good, but hwne this more I cant make it work...
Here is the code so far:
$id = $_GET['id']; $get_trade = mysql_query("SELECT * FROM `trade` WHERE `id` = '$id'",$link); $run_trade = mysql_fetch_array($get_trade) or die(mysql_error()); $team1 = "" .$run_trade['team1']. ""; $team2 = "" .$run_trade['team2']. ""; $players1 = "" .$run_trade['players1']. ""; $players2 = "" .$run_trade['players2']. ""; $table1 = " <table> <thead> <tr> <th colspan='7'>$team1</th> </tr> <tr> <th>Nom</th> <th>Contrat</th> <th>Salaire</th> <th>Age</th> <th>Off</th> <th>Def</th> <th>Oa</th> </tr> </thead> <tfoot> <tr> <th colspan='7'> </th> </tr> </tfoot> "; $table2 = " <table> <thead> <tr> <th colspan='7'>$team2</th> </tr> <tr> <th>Nom</th> <th>Contrat</th> <th>Salaire</th> <th>Age</th> <th>Off</th> <th>Def</th> <th>Oa</th> </tr> </thead> <tfoot> <tr> <th colspan='7'> </th> </tr> </tfoot>"; $count1 = substr_count($players1,","); $count2 = substr_count($players2,","); $players1 = rawurldecode($players1); $players1 = explode(",",$players1); $players2 = explode(",",$players2); $x1 = 0; $x2 = 0; while($count1 > $x1) { echo "<br/>$x1<br/>"; $numberOfNumbersFound1 = preg_match("/[0-9]+/", $players1[$x1]); echo "$players1[$x1] $numberOfNumbersFound1"; if ($numberOfNumbersFound1 == "0" ) { $get_stats = mysql_query("SELECT * FROM `players` WHERE `name` = '$players1[$x1]'",$link); $run_stats = mysql_fetch_array($get_stats) or die(mysql_error()); $off = "" .$run_stats['off']. ""; $def = "" .$run_stats['def']. ""; $oa = "" .$run_stats['oa']. ""; $age = "" .$run_stats['age']. ""; $salary = "" .$run_stats['salary']. ""; $contract = "" .$run_stats['contract_lenght']. ""; $body1 = "$body1 <tr><td>$players1[$x1]</td><td>$contrat</td><td>$salary</td><td>$age</td><td>$off</td><td>$def</td><td>$oa</td></tr>"; } else { $body1 = "$body1 <tr><td colspan='7'>$players1[$x1]</td></tr>"; } $x1 ++; } while($count2 > $x2) { $numberOfNumbersFound2 = preg_match("/[0-9]+/", $players2[$x2]); if ($numberOfNumbersFound2 == "0" ) { $get_stats = mysql_query("SELECT * FROM `players` WHERE `name` = '$players2[$x2]'",$link); $run_stats = mysql_fetch_array($get_stats) or die(mysql_error()); $off = "" .$run_stats['off']. ""; $def = "" .$run_stats['def']. ""; $oa = "" .$run_stats['oa']. ""; $age = "" .$run_stats['age']. ""; $salary = "" .$run_stats['salary']. ""; $contract = "" .$run_stats['contract_lenght']. ""; $body2 = " <tr><td>$player</td><td>$contract</td><td>$salary</td><td>$age</td><td>$off</td><td>$def</td><td>$oa</td></tr>"; } else { $body2 = " <tr><td colspan='7'>$players2[$x2]</td></tr>"; } $x2 ++; } $close = "</table>"; $response = "$table1 $body1 $close<br/>$table2 $body2 $close";
And I output the $response in the body tag.
Thanks for your help,
Ara
-
Isnt there a way of giving it a reste? Like mysql rest for exemple?
I cant change the php.ini file... my host doesnt allow it.
-
Hi I get this error now:
Fatal error: Maximum execution time of 20 seconds exceeded in /home/liguehs/public_html/converter/test_players.php on line 6
-
-
Hi,
Thanks for your help,
But I get the following error:
Warning: feof(): supplied argument is not a valid stream resource in /home/liguehs/public_html/converter/test_players.php on line 4
-
I think cbolson is right for the:
$pic=($_FILES['photo']['name']);
Just to make sur can you output $pic to see if its correct?
-
No, I just copied skipped the $...
The thing is this is the output of:
echo "$players1[$x1] $numberOfNumbersFound1";
Milan Michalek 0 5 Los Angels Kings 2010 1 Jordan Foote 0
It outputs correctly the 3 datas in the string, but it stops there.
the reste of the code:
while($count2 > $x2) { $numberOfNumbersFound2 = preg_match("/[0-9]+/", $players2[$x2]); echo "$players2[$x2] $numberOfNumbersFound2"; if ($numberOfNumbersFound2 > 0 ) { $body1 = " <tr><td colspan='7'>$players2[$x2]</td></tr>"; } else { $get_stats = mysql_query("SELECT * FROM `players` WHERE `name` = '$players2[$x2]'",$link); $run_stats = mysql_fetch_array($get_stats) or die(mysql_error()); $off = "" .$run_stats['off']. ""; $def = "" .$run_stats['def']. ""; $oa = "" .$run_stats['oa']. ""; $age = "" .$run_stats['age']. ""; $salary = "" .$run_stats['salary']. ""; $contract = "" .$run_stats['contract_lenght']. ""; $body2 = " <tr><td>$player</td><td>$contract</td><td>$salary</td><td>$age</td><td>$off</td><td>$def</td><td>$oa</td></tr>"; } $x2 ++; } $close = "</table>"; $response = "$table1 $body1 $close<br/>$table2 $body2 $close";
-
string(62) "Milan%20Michalek, 5 Los Angels Kings 2010, Jordan%20Foote, "
-
Sure:
$id = $_GET['id']; $get_trade = mysql_query("SELECT * FROM `trade` WHERE `id` = '$id'",$link); $run_trade = mysql_fetch_array($get_trade) or die(mysql_error()); $team1 = "" .$run_trade['team1']. ""; $team2 = "" .$run_trade['team2']. ""; $players1 = "" .$run_trade['players1']. ""; $players2 = "" .$run_trade['players2']. "";
-
Hi,
I am making a code that checks if an array has a number inside. If so it outputs it in a single td, if not it searches the players value and inserts it in 7 different td's, but it doesnt work.
count1 = substr_count($players1,","); $count2 = substr_count($players2,","); $players1 = rawurldecode($players1); $players1 = explode(",",$players1); $players2 = explode(",",$players2); $numberOfNumbersFound = preg_match("/[0-9]+/", $players1[0]); $x1 = 0; $x2 = 0; while($count1 > $x1) { $numberOfNumbersFound1 = preg_match("/[0-9]+/", $players1[$x1]); echo "$players1[$x1] $numberOfNumbersFound1"; if ($numberOfNumbersFound1 > "0" ) { $body1 = " <tr><td colspan='7'>$players1[$x1]</td></tr>"; } else { $get_stats = mysql_query("SELECT * FROM `players` WHERE `name` = '$players1[$x1]'",$link); $run_stats = mysql_fetch_array($get_stats) or die(mysql_error()); $off = "" .$run_stats['off']. ""; $def = "" .$run_stats['def']. ""; $oa = "" .$run_stats['oa']. ""; $age = "" .$run_stats['age']. ""; $salary = "" .$run_stats['salary']. ""; $contract = "" .$run_stats['contract_lenght']. ""; $body1 = " <tr><td>$player</td><td>$contract</td><td>$salary</td><td>$age</td><td>$off</td><td>$def</td><td>$oa</td></tr>"; } $x1 ++; }
Thanks for your help,
Ara
updating MySQL database table
in PHP Coding Help
Posted
No because he splits the query line and the actual query.
Doing:
Is the same as