
rwachowiak
Members-
Posts
50 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
rwachowiak's Achievements

Member (2/5)
0
Reputation
-
Ok, so what im trying to achieve is this... you come to this page: http://www.hutcommunity.com/Database/playercard.php You click on a player... and his information is loaded into the table. You can then add "training cards" to the players stats... eg, +5skt or +9 skt, etc, to get them higher stats. each player has a set amount of training slots. below is my code, and its pretty close, but when you do a +9skt and +9hnd, its adding +9 and +9 to stats 1 and 2 instead of 9 for each one... because of the code... so how would i be able to achieve this?? i feel like im really close!!! <!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>Player Card</title> <script type="text/javascript" src="jquery-1.3.2.js"></script> <script type="text/javascript" src="jquery.form.js"></script> <script type="text/javascript"> // wait for the DOM to be loaded $(document).ready(function() { // bind 'myForm' and provide a simple callback function $('#myForm').ajaxForm(function() { alert("Thank you for your comment!"); }); }); </script> </head> <body> <table cellpadding="0" cellspacing="0" class="display" id="example"> <thead> <tr> <th></th> <th align="left">FIRST NAME</th> <th align="left">LAST NAME</th> <th align="center">OVR</th> <th align="center">POT</th> <th align="left">TEAM</th> <th align="left">LEAGUE</th> <th align="center">SKT</th> <th align="center">SHT</th> <th align="center">HND</th> <th align="center">CHK</th> <th align="center">DEF</th> <th>SALARY</th> <th>CAREER</th> <th align="center">POSITION</th> <th>TYPE</th> <th>SLOTS</th> </tr> </thead> <tbody> <? $username="???"; $password="???"; $database="???"; mysql_connect('hutcommunity.db.6977873.hostedresource.com',$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM Players WHERE Team='Buffalo Sabres'"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $First_Name=mysql_result($result,$i,"First_Name"); $Last_Name=mysql_result($result,$i,"Last_Name"); $Team=mysql_result($result,$i,"Team"); $League=mysql_result($result,$i,"League"); $Career_Games=mysql_result($result,$i,"Career_Games"); $Salary=mysql_result($result,$i,"Salary"); $Position=mysql_result($result,$i,"Position"); $Player_Type=mysql_result($result,$i,"Player_Type"); $Training_Slots=mysql_result($result,$i,"Training_Slots"); $Stat_1=mysql_result($result,$i,"Stat_1"); $Stat_2=mysql_result($result,$i,"Stat_2"); $Stat_3=mysql_result($result,$i,"Stat_3"); $Stat_4=mysql_result($result,$i,"Stat_4"); $Stat_5=mysql_result($result,$i,"Stat_5"); $Overall=mysql_result($result,$i,"Overall"); $Potential=mysql_result($result,$i,"Potential"); $Mugshot=mysql_result($result,$i,"Mugshot"); echo "<tr> <td><img src=\"http://cdn.nhl.com/photos/mugs/thumb/$Mugshot.jpg\" width=\"37\" height=\"47\" /></td> <td><strong><span class=\"Name\"><a href=\"playercard.php?id=$Mugshot\">$First_Name</a></strong</span></td> <td><strong><span class=\"Name\"><a href=\"playercard.php?id=$Mugshot\">$Last_Name</a></strong</span></td> <td align=\"center\"><span class=\"Overall\"><strong>$Overall</strong></span></td> <td align=\"center\"><span class=\"Potential\"><strong>$Potential</strong></span></td> <td>$Team</td> <td align=\"center\">$League</td> <td align=\"center\"><strong>$Stat_1</strong></td> <td align=\"center\"><strong>$Stat_2</strong</td> <td align=\"center\"><strong>$Stat_3</strong</td> <td align=\"center\"><strong>$Stat_4</strong</td> <td align=\"center\"><strong>$Stat_5</strong</td> <td align=\"center\">$Salary</td> <td align=\"center\">$Career_Games</td> <td align=\"center\">($Position)</td> <td align=\"center\">$Player_Type</td> <td>0 / $Training_Slots</td> </tr> "; $i++; } ?> </tbody> </table> <? $username="???"; $password="???"; $database="???"; $id = $_GET['id']; $Slot1=$_POST['Slot1']; $Slot2=$_POST['Slot2']; $Slot3=$_POST['Slot3']; $Slot4=$_POST['Slot4']; $Slot5=$_POST['Slot5']; $Slot6=$_POST['Slot6']; $Slot7=$_POST['Slot7']; $Slot8=$_POST['Slot8']; $Slot9=$_POST['Slot9']; $Slot10=$_POST['Slot10']; $Slot11=$_POST['Slot11']; $Slot12=$_POST['Slot12']; mysql_connect('hutcommunity.db.6977873.hostedresource.com',$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM Players WHERE Mugshot='$id'"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $First_Name=mysql_result($result,$i,"First_Name"); $Last_Name=mysql_result($result,$i,"Last_Name"); $Team=mysql_result($result,$i,"Team"); $League=mysql_result($result,$i,"League"); $Career_Games=mysql_result($result,$i,"Career_Games"); $Salary=mysql_result($result,$i,"Salary"); $Position=mysql_result($result,$i,"Position"); $Player_Type=mysql_result($result,$i,"Player_Type"); $Training_Slots=mysql_result($result,$i,"Training_Slots"); $Stat_1=mysql_result($result,$i,"Stat_1"); $Stat_2=mysql_result($result,$i,"Stat_2"); $Stat_3=mysql_result($result,$i,"Stat_3"); $Stat_4=mysql_result($result,$i,"Stat_4"); $Stat_5=mysql_result($result,$i,"Stat_5"); $Overall=mysql_result($result,$i,"Overall"); $Potential=mysql_result($result,$i,"Potential"); $Mugshot=mysql_result($result,$i,"Mugshot"); $S1M99 = 99-$Stat_1; $S2M99 = 99-$Stat_2; $S3M99 = 99-$Stat_3; $S4M99 = 99-$Stat_4; $S5M99 = 99-$Stat_5; $SKATE5=5; $SKATE7=7; $SKATE9=9; $HAND5=5; $HAND7=7; $HAND9=9; $SKATETOTAL = $Stat_1+$Slot1+$Slot2; $HANDTOTAL = $Stat_2+$Slot1+$Slot2; echo " <table width=\"500\" border=\"2\" cellspacing=\"2\" cellpadding=\"2\"> <tr> <td colspan=\"3\" rowspan=\"3\"><img src=\"http://cdn.nhl.com/photos/mugs/$Mugshot.jpg\"/></td> <td width=\"294\">$League</td> </tr> <tr> <td>$Team</td> </tr> <tr> <td>$Overall $Potential</td> </tr> <tr> <td colspan=\"4\">$First_Name $Last_Name</td> </tr> <tr> <td width=\"67\">SKT</td> <td width=\"58\">$Stat_1</td> <td width=\"43\">$S1M99</td> <td>$SKATETOTAL</td> </tr> <tr> <td>SHT</td> <td>$Stat_2</td> <td>$S2M99</td> <td>$HANDTOTAL</td> </tr> <tr> <td>HND</td> <td>$Stat_3</td> <td>$S3M99</td> <td> </td> </tr> <tr> <td>CHK</td> <td>$Stat_4</td> <td>$S4M99</td> <td> </td> </tr> <tr> <td>DEF</td> <td>$Stat_5</td> <td>$S5M99</td> <td> </td> </tr> </table> "; $i++; } ?> <form id="myForm" method="post"> <? $username="???"; $password="???"; $database="???"; $id = $_GET['id']; mysql_connect('hutcommunity.db.6977873.hostedresource.com',$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM Players WHERE Mugshot='$id'"; $result=mysql_query($query); $var = $Training_Slots; foreach(range(1,$var) as $num) { echo "Training Slot $num: <select name=\"Slot$num\" id=\"Slot$num\"> <option value=\"\">Choose Training</option> <option value=\"$SKATE5\">+5 SKT</option> <option value=\"$SKATE7\">+7 SKT</option> <option value=\"$SKATE9\">+9 SKT</option> <option value=\"$HAND5\">+5 HND</option> <option value=\"$HAND7\">+7 HND</option> <option value=\"$HAND9\">+9 HND</option> </select><br> "; } ?> <input type="Submit"> </form> </body> </html>
-
yup got it! thanks guys! <form id="myForm" method="post"> <? $username="??"; $password="??"; $database="??"; $id = $_GET['id']; mysql_connect('hostname',$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM Players WHERE Mugshot='$id'"; $result=mysql_query($query); $var = $Training_Slots; foreach(range(1,$var) as $num) { echo "Training Slot $num: <select name=\"Slot$num\" id=\"Slot$num\"> <option value=\"\">Choose Training</option> <option value=\"5\">5 SKT</option> <option value=\"7\">7 SKT</option> <option value=\"9\">9 SKT</option> </select><br> "; } ?> <input type="Submit"> </form> edit: removed hostname from mysql_connect
-
Thanks for the input... what im really looking for is this: I have a query that pulls a number from a database... the number will change based on the WHERE clause... and with each different number, i need an output that adds a form input, 1 for each number... so if the variable = 5, there needs to be 5 inputs in the form, if the variable is 3, then 3 inputs in the form... and so on. so would i have something like: <form> <?php $var = $Training_Slots; foreach(range(1,$var) as $num) { echo "<input id=\"Slot$num\"><br />"; } my code is way off, but you get the idea? ?>
-
Lets say I have: $var=5; What would an output look like to get me: 1<br> 2<br> 3<br> 4<br> 5<br> Im at a complete loss! Thanks!
-
Came up with something... thoughts? http://www.hutcommunity.com/Database/playercard.php
-
https://spreadsheets.google.com/ccc?key=0ArqmVVzMUYNadDZzekE2WWdlX3lNMFlieWRUQkZzM3c&hl=en&authkey=CI3uhqUB I uploaded it to google... hows that?
-
Well sorry... its just a spreadsheet... ive got 40+ posts here... anyways... how would i post a excel spreadsheet code chief?
-
Hey all, I hope this is the right forum... if not someone can move it! So, here is my idea: I have a database of "Cards" for the game NHL 11, for the mode Hockey Ultimate Team,... check out the database/page here: http://www.hutcommunity.com/Database/ Basically, all that info is a direct representation of the MySQL Database. Now, in the game, you can add "Training" Cards to the players, as per however many "Training Slots" they have. The training cards can be like +5 SKT, +9 SKT, +3 All, which adds +3 to all their stats. So my idea is that when you click on a players name or picture, you get a new page, called "Training Page" or something, and you get all the player info, with... well its hard to describe, but ive made a excel 2010 spreadsheet to kind of give you the idea im looking for. See the attachment for the spreadsheet. Now, the information that these people wont be able to be saved, just observed to see how they can train X player... So, I have no idea where to start, and if anyone can give me some ideas or point me in the right direction, that would be great! Thanks! [attachment deleted by admin]
-
uh... ive looked and looked it all i can see is that it replaces the 0 no matter what... i cant figure it out i been searching for a while now...
-
ah nice thats how! perfect!!!! ok... but now it changes 10 to 1-... VERY CLOSE THOUGH!! how can i make it exact?? hmm
-
how do i do the replace? there are 0's in the wk1act and week1 fields... but there are also other numbers, but in the query, i want all the numbers that arent 0 to show properly, and if a zero is found i want it as a -... any ideas?
-
yes perfect, now what about if i got this going on: $id = (isset($_GET['Userid']))? mysql_escape_string($_GET['Userid']) : "1"; $query = "SELECT (wk1act-week1), week1, wk1act FROM staff JOIN project ON project.staff_id=staff.id WHERE project.staff_id='$id' GROUP BY project.id"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo "<tr>". "<td width='40' height='20' class='vertspreader'><div align='center'>{$row['week1']}</div></td>" . "<td width='40' height='20' class='topspreader'><div align='center'>{$row['wk1act']}</div></td>" . "<td width='40' height='20' class='topspreader'><div align='center'>{$row['(wk1act-week1)']}</div></td>" . } </tr> thanks!!!
-
whats the easiest way to a query turn 0's (zeros) into "-" in the display? this is my code so far... but say Field 1 is a 0, i want a - there instead but i cant use a and if then statement because the actual query is massive... $query = "SELECT * FROM table"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo "Instead of 0 this is a -: {$row['field1']}"; } thanks!
-
sorry to be a huge pain, i might be missing something. nothing is showing up on the page for this query =(
-
what would the whole thing look like? including the echo and stuff? sorry im still pretty new to mysql =(