Please excuse noobiness on my part (only started writing php today)…
I am trying to write a football players database app for fantasy league football as a way of picking up php as quickly as possible. Am using php and mySQL.
Have got stuck on this bit though
I want to put a drop down list next to each player. In the list I want the default value to be set for each player, if it exists in the database, to the entry in the database. So if a player has previously been set as a defender then the listbox should have defender set as the default for the listbox.
Here is the bit that I am trying to get to do that (have stripped out the other fields other than position in order to keep this post succint):
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo("") { if ($row['Position'] = 'GK') { echo("GK"); } else { echo("GK "); } if ($row['Position'] = 'DEF') { echo("DEF"); } else { echo("DEF "); } if ($row['Position'] = 'MID') { echo("MID"); } else { echo("MID"); } if ($row['Position'] = 'FWD') { echo("FWD"); } else { echo("FWD"); } ");}
I am pretty sure I am screwing up with syntax somewhere or perhaps php just doesn’t like where I have put that IF.
There are probably much easier ways of doing what I am trying to do (function?) but I am slightly lost with the syntax of this and why it is not working.
Any help/pointers/slap the noob appreciated…
O.