Free php web host - Try It Out Managing the Characters The next

Try It Out Managing the Characters The next file you re going to create will display a list of the characters in your database. 1. Enter the following code, and save it as charlist.php: alias ASC , 2 => name ASC , 3 => align ASC, alias ASC ); $conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die( Could not connect to MySQL database. . mysql_error()); mysql_select_db(SQL_DB, $conn); $sql = SELECT c.id, p.power . FROM char_main c . JOIN char_power p . JOIN char_power_link pk . ON c.id = pk.char_id AND p.id = pk.power_id ; $result = mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result)) { $p[$row[ id ]][] = $row[ power ]; } foreach ($p as $key => $value) { $powers[$key] = implode( , , $value); } } $sql = SELECT c.id, n.alias . FROM char_main c . JOIN char_good_bad_link gb . JOIN char_main n . ON (c.id = gb.good_id AND n.id = gb.bad_id) . OR (n.id = gb.good_id AND c.id = gb.bad_id) ; $result = mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result)) { $e[$row[ id ]][] = $row[ alias ]; } foreach ($e as $key => $value) { 306 Chapter 10
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.