Jump to content

kee1108

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Posts posted by kee1108

  1. Hello,

     

    I am still relatively new to PHP, so I will have a clue if there is something on hand rather than writing from scratch.  But I know eventually I will have to do that.

     

    Ok.  So I am planning to write a script that works similarly to a sport draft.  I will need people to login.  Each member will be assigned a team.  We will have a predetermined draft order and a pool of players for selection.  As for the drafting itself, I will like to allow a member to be able to draft when they are on the clock, I will like to have just 1 result page, and it will get updated after each pick, and the player that gets drafted will be taken off the pool.

     

    I am not asking for any code, just I want to have someone to guide me to the right direction.  What do I really need to achieve what I intended to build?  And maybe some tutorial reference for similar tasks that I can look up.

     

    Thank you very much.

  2. first, do you have an entry for each player in the rfa table, just with a value of either "yes" or "no"? or is there simply no entry for the player if they have no RFA? if the former, you will need to change the condition to rfa.rfa <> 'Yes', since even when they have no RFA, they will still have a value for it.

     

    as for the PGID issue, it might be helpful to stipulate which table all the data is coming from:

     

    SELECT players.* FROM players ...

     

    see if that helps. if it doesn't, try print_r() on $row to see what data is coming out of the query - that might help you find the correct key. i would suspect it's tripping up because there is a PGID in both tables.

     

    As for the first issue, I am not even going to try to make my way to work. :D The way you suggested is a lot more neater :).

     

    The PGID is now solved as well.  THANKS.  You are the man.  I was trying to specific the table.column in the output portion.  But instead selected only from the players table in the query will work.

     

    Thank you very much!!!

  3. Thank you very much for the quick respond.  I did try LEFT OUTER JOIN, but I was trying to state the condition where RFA <> 'Yes' or something like that.

     

    Using IS NULL seems to do the trick.  It works now.  But I run into another problem.  When I try to echo the PGID within a link, it doesn't work.  I also tried players.PGID and still it doesn't add to the link.  It was working before.

     

    <?php
    // Make a MySQL Connection
    mysql_connect("localhost", "root", "rootadmin") or die(mysql_error());
    mysql_select_db("rzca-football_rzl") or die(mysql_error());
    
    // Get specific results from the database
    $query = "SELECT * FROM players LEFT OUTER JOIN rfa ON players.PGID = rfa.PGID WHERE players.Contract_Left = '1' AND rfa.rfa IS NULL ORDER BY players.Team";
    $result = mysql_query($query) or die(mysql_error());
    ?>
    
    <div>
    
    <table border="0" class="smallplainWithBorder" cellpadding="2" cellspacing="0" width="600">
    
    <tr class="darkback">
    <td colspan="7" valign="bottom" class="statcell"><b><h1>Pontential Free Agent In 2013</h1></b></td>
    </tr>
    <?php while($row = mysql_fetch_array( $result )) {
    	echo "<tr class='darkback'>";
    	echo "<td class=statcell>" . "<img src=http://rzl-football.com/files/images/icons/".$row['Team'].".gif>" . "</td>";
    	echo "<td class=statcell>" . "<a href=http://rzl-football.com/player.php?pgid=".$row['PGID'].">" . $row['First_Name'] . " " . $row['Last_Name'] . "</a></td>";
    	echo "<td class=statcell>" . $row['Pos'] . "</td>";
    	echo "<td class=statcell>" . $row['Age'] . "</td>";
    	echo "<td class=statcell>" . $row['HGT'] . "</td>";
    	echo "<td class=statcell>" . $row['WGT'] . "</td>";
    	echo "<td class=statcell>" . $row['OVR'] . "</td>";
    	echo "</tr>";
    	}
     ?>
    </table>
    
    </div>

     

     

  4. I have two tables, one has all the information, and the other one has all the row of a particular status.  I tried to join them and then select from the result of the join.  How should I do it?  I am very new to php.

     

    Or is there a better way to do this.  Table 1 has column (ID, Names, Contract_Left, etc), Table 2 has column (ID, RFA).  Basically I just want the names with a contract left of 1 year who isn't a RFA.  Table 2 only contains IDs for those who is RFA.

     

    <?php
    // Make a MySQL Connection
    mysql_connect("localhost", "USERNAME", "PW") or die(mysql_error());
    mysql_select_db("rzca-football_rzl") or die(mysql_error());
    
    // Get specific results from the database
    $query = "SELECT * FROM players LEFT JOIN rfa ON players.PGID = rfa.PGID UNION
    			SELECT * FROM players RIGHT JOIN rfa ON players.PGID = rfa.PGID WHERE players.PGID IS NULL
    			WHERE players.Contract_Left = '1' ORDER BY players.Team";
    $result = mysql_query($query) or die(mysql_error());
    ?>
    
    <div>
    
    <table border="0" class="smallplainWithBorder" cellpadding="2" cellspacing="0" width="600">
    
    <tr class="darkback">
    <td colspan="7" valign="bottom" class="statcell"><b><h1>Pontential Free Agent In 2013</h1></b></td>
    </tr>
    <?php while($row = mysql_fetch_array( $result )) {
    	echo "<tr class='darkback'>";
    	echo "<td class=statcell>" . "<img src=http://rzl-football.com/files/images/icons/".$row['Team'].".gif>" . "</td>";
    	echo "<td class=statcell>" . "<a href=http://rzl-football.com/player.php?pgid=".$row['PGID'].">" . $row['First_Name'] . " " . $row['Last_Name'] . "</a></td>";
    	echo "<td class=statcell>" . $row['Pos'] . "</td>";
    	echo "<td class=statcell>" . $row['Age'] . "</td>";
    	echo "<td class=statcell>" . $row['HGT'] . "</td>";
    	echo "<td class=statcell>" . $row['WGT'] . "</td>";
    	echo "<td class=statcell>" . $row['OVR'] . "</td>";
    	echo "</tr>";
    	}
     ?>
    </table>
    
    </div>

     

    Thank you very much in advance.  Any pointer will help.

  5. Hope someone can help me out.

    I have two tables in mysql, one is showing all the personal information of a group of athletes (also store an indicator to show wheather they are injured or not).  I am planning to create another table to store all the players with injuries and their type of injury.

    So my question is, is it possible if I want to call for a table for all the players that is with injuries (I want to show their info as well as the type of injury from the 2nd table.)

    Hope someone can help me out or give me some direction on how to do it.

    Or is there a easier way to do this?

    Thank you.

    -Ricky
  6. Hi everyone,

    I just need some help, I want to know how to get a specific image from a local folder.  I dont' mind one image, but if I have 32 images which is correspond to 32 sport teams, how can I make the code so that it will pick the right image correspond to the team and I only have 1 team.php setup.

    Thanks for any help.
×
×
  • 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.