Web server logs - charedit.php This file does double-duty, so it s a

charedit.php This file does double-duty, so it s a little longer. But a lot of it is HTML, and much of what it does you have already done before, so this shouldn t be too difficult. The default functionality of this page is New Character mode. If there is a value in $char other than 0, the script will pull the data and change the default values. if (!isset($_GET[ c ]) || $_GET[ c ] == || !is_numeric($_GET[ c ])) { $char= 0 ; } else { $char = $_GET[ c ]; } $subtype = Create ; $subhead = Please enter character data and click . $subtype Character. ; $tablebg = #EEEEFF ; Next, the script gets all the powers, and puts them into an array to be accessed later (when building the power select field on the form). $sql = SELECT id, power FROM char_power ; $result = mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result)) { $pwrlist[$row[ id ]] = $row[ power ]; } } All characters except the chosen character will be pulled from the database to be used for the Enemies field. If the character ID is not valid, then all characters will be pulled for the Enemies field. $sql = SELECT id, alias FROM char_main WHERE id != $char ; $result = mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result); $charlist[$row[ id ]] = $row[ alias ]; } If there is a character id, the script attempts to pull the data from the database. This SQL statement is also a JOIN, although the JOIN keyword is not used. You can identify such a JOIN because there are two or more tables, and the WHERE keyword is matching columns from each of the tables. The JOIN in this case is implied. Once all the tables are joined, all the appropriate fields are pulled as long as the character ID in the character table matches $char. If there is no match, no records will be returned. If there is a match, one record is returned and the row is stored in $ch. if ($char != 0 ) { $sql = SELECT c.alias, c.real_name AS name, c.align, . l.lair_addr AS address, z.city, z.state, z.id AS zip . FROM char_main c, char_lair l, char_zipcode z . WHERE z.id = l.zip_id . 320 Chapter 10
You want to have a cheap webhost for your apache application, then check apache web hosting services.

Leave a Reply