Jump to content

Need help with PhP site


Recommended Posts

Well first of all im trying to build a fantasy football website.. nothing very detailed.. its just a simple project for a class.... so what im trying achieve at this point is to be able to select players from a list that will be shown of players.. and being able to select them into a team and each player has a price and a each team has a price limit.

This is what i have done right now (so what i need help with is to be able to click on the player names displayed, and choose them and save them on another table.)


<table border='1' align='right'>
<form action="fantasy.php" method="get">
<b>Order by:</b>
<input type="radio" name="order" value="cost">Cost
<input type="radio" name="order" value="points">Points
<input type="radio" name="order" value="name">Name
<input type="radio" name="by" value="ASC">Ascending
<input type="radio" name="by" value="DESC">Descending
<select name="position">
 <option selected value ="all">Show All</option>
 <option value ="WHERE position = 'Goalkeeper'">Goalkeepers</option>
 <option value ="WHERE position = 'Defender'">Defenders</option>
 <option value ="WHERE position = 'Midfield'">Midfielders</option>
 <option value ="WHERE position = 'Forward'">Forwards</option>
 <option value ="WHERE team = 'Deportivo Cali'">Deportivo Cali</option>
 <option value ="WHERE team = 'Deportes Quindio'">Deportes Quindio</option>
 <option value ="WHERE team = 'Nacional'">Atletico Nacional</option>
 <option value ="WHERE team = 'Atletico Huila'">Atletico Huila</option>
 <option value ="WHERE team = 'Pereira'">Deportivo Pereira</option>
 <option value ="WHERE team = 'Medellin'">Independiente Medellin</option>
 <option value ="WHERE team = 'La Equidad'">La Equidad</option>
 <option value ="WHERE team = 'Millonarios'">Millonarios</option>
 <option value ="WHERE team = 'Tolima'">Deportes Tolima</option>
 <option value ="WHERE team = 'Pasto'">Deportivo Pasto</option>
 <option value ="WHERE team = 'Junior'">Atletico Junior</option>
 <option value ="WHERE team = 'Once Caldas'">Once Caldas</option>
 <option value ="WHERE team = 'Chico'">Chico FC</option>
 <option value ="WHERE team = 'Real Cartagena'">Real Cartagena</option>
 <option value ="WHERE team = 'Santa Fe'">Santa fe</option>
 <option value ="WHERE team = 'Cucuta'">Cucuta Deportivo</option>
 <option value ="WHERE team = 'Bucaramanga'">Atletico Bucaramanga</option>

<input type="submit" value="Submit">
$con = mysql_connect("localhost","root");
if (!$con)
 die('Could not connect: ' . mysql_error());

mysql_select_db("fantasy", $con);
if($_GET['position'] == 'all') {
$position = "";}
else { $position = $_GET[position];}
$query= "SELECT * FROM players  ".$position." ORDER BY '".$_GET['order']."' ".$_GET['by'].",'position','name'";

$result = mysql_query($query);

echo "<br><table border='1' align='right'>

while($row = mysql_fetch_array($result))
 echo "<tr>";
 echo "<td>" . "<a href=fantasy.php?manid=".$row['id']."&action=addtoteam>".$row['name']."</a>" . "</td>";
 echo "<td>" . $row['team'] . "</td>";
 echo "<td>" . $row['position'] . "</td>";
 echo "<td>" . $row['cost'] . "</td>";
 echo "<td>" . $row['points'] . "</td>";
 echo "</tr>";
echo "</table>";
echo $query;


Any help is appreciated,



Edited by daniel

Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now

  • Create New...