FutileSoul Posted March 19, 2007 Share Posted March 19, 2007 i'm throwing a site together for a friend of mine >> http://patspoker.awardspace.com/ and on the left side in the standings i currently have to edit the code if i want to change the ranks and the +/- data. is there a script where i could login to create the tables and edit them or something. Quote Link to comment Share on other sites More sharing options...
bwochinski Posted March 19, 2007 Share Posted March 19, 2007 Are the player info and ratings already stored in a database? If so, it's a matter of a simple SELECT and a few lines of PHP to automatically show the current ratings. If the players aren't stored in a database, you should make that happen. Quote Link to comment Share on other sites More sharing options...
FutileSoul Posted March 20, 2007 Author Share Posted March 20, 2007 the players aren't in the database, i just have the players and the (+/-) in the html code how would i go about putting the players in the database? <table> <font align=right> <TH>Name</TH> <td></td><td></td><td></td> <TH>+/-</TH> <tr></tr> <TR> <TD>Pat</TD> <td></td><td></td><td></td> <TD>+184</TD> <TR> <TD>Dez</TD> <td></td><td></td><td></td> <TD>+151</TD> <TR> <TD>Michaels</TD> <td></td><td></td><td></td> <TD>+115</TD> <TR> <TD>Seth</TD> <td></td><td></td><td></td> <TD>+35</TD> <TR> <TD>Aron</TD> <td></td><td></td><td></td> <TD>+31</TD> <TR> <TD>Cory</TD> <td></td><td></td><td></td> <TD>+28</TD> <TR> <TD>Ryan</TD> <td></td><td></td><td></td> <TD>+3</TD> <TR> <TD>Andy</TD> <td></td><td></td><td></td> <TD>-6</TD> <TR> <TD>Josh</TD> <td></td><td></td><td></td> <TD>-40</TD> <TR> <TD>Turner</TD> <td></td><td></td><td></td> <TD>-40</TD> <TR> <TD>Long</TD> <td></td><td></td><td></td> <TD>-58</TD> <TR> <TD>Adam</TD> <td></td><td></td><td></td> <TD>-60</TD> <TR> <TD>Justin</TD> <td></td><td></td><td></td> <TD>-60</TD> <TR> <TD>Gloves</TD> <td></td><td></td><td></td> <TD>-70</TD> <TR> <TD>Sean</TD> <td></td><td></td><td></td> <TD>-160</TD> <TR> <td><small><small>Last Updated 3/19/07</small></small></td> </table> Quote Link to comment Share on other sites More sharing options...
mjlogan Posted March 20, 2007 Share Posted March 20, 2007 You will need a database, with a users table in, with at the moment, three columns. id, name, score Quote Link to comment Share on other sites More sharing options...
FutileSoul Posted March 20, 2007 Author Share Posted March 20, 2007 can you throw me a link to show how to do this, or explain yourself. Quote Link to comment Share on other sites More sharing options...
FutileSoul Posted March 20, 2007 Author Share Posted March 20, 2007 i found this site >> http://www.tizag.com/mysqlTutorial/mysqltables.php and tried using the code (changing the db host, dbname and password, and the table name) and i get an error "Access denied for user 'futilesoul_wp'@'82.197.131.12' to database 'test'" what am i doing wrong <?php // Make a MySQL Connection mysql_connect("db1.awardspace.com", "futilesoul_wp", "mypassword") or die(mysql_error()); mysql_select_db("test") or die(mysql_error()); // Create a MySQL table in the selected database mysql_query("CREATE TABLE rankings( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), name VARCHAR(30), age INT)") or die(mysql_error()); echo "Table Created!"; ?> Quote Link to comment Share on other sites More sharing options...
FutileSoul Posted March 20, 2007 Author Share Posted March 20, 2007 i just figured that part out, i had to change "test" to my database name how do i start inputting the data into the tables? Quote Link to comment Share on other sites More sharing options...
only one Posted March 20, 2007 Share Posted March 20, 2007 mysql_query("inset into table name ('the feild names') values ('the things to be insteted')"); bold bits have to be edited Quote Link to comment Share on other sites More sharing options...
FutileSoul Posted March 20, 2007 Author Share Posted March 20, 2007 i got the stuff coded and the data inputted into the database and it is up on patspoker.awardspace.com now here comes the tricky part... instead of using the following format to edit this almost daily, how would i go about making some sort of page where i could click a name and edit their score, and add new names and scores? <?php // Connect to MySQL // Get Sandy's record from the "example" table $result = mysql_query("UPDATE example SET age='22' WHERE age='21'") or die(mysql_error()); $result = mysql_query("SELECT * FROM example WHERE age='22'") or die(mysql_error()); // get the first (and hopefully only) entry from the result $row = mysql_fetch_array( $result ); echo $row['name']." - ".$row['age']. "<br />"; ?> Quote Link to comment Share on other sites More sharing options...
Greaser9780 Posted March 20, 2007 Share Posted March 20, 2007 Personally I would set up a form for yourself in html. Playername and new stat field. Then create a php page that the form posts to. In that page you will have something like $player = $_POST['player']; and $stat = $_POST['stat']; Those need to match what you posted. Then connect to your db. Followed by: $sql = mysql_query(UPDATE `table_name` SET `player` = '$player', stat = '$stat' WHERE player = '$player'") or die(mysql_error()); That should update the stats for you. Or you could always create a dynamic link to a php page that will echo the players name and ask you for the new stat. And upon clicking a submit button it would do my previous update. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.