Difference between revisions of "Test:Test"

From OOUG
Jump to navigation Jump to search
(Replaced content with "This is for testing")
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
This is for testing
 
This is for testing
<?php                                                                          |
 
$con = mysql_connect("localhost","root","Sert1!@#");                            |
 
                                                                                |
 
if (!$con)                                                                      |
 
  {                                                                            |
 
    die('Could not connect: ' . mysql_error());                                |
 
  }                                                                            |
 
                                                                                |
 
mysql_select_db("pokedex", $con);                                              |
 
                                                                                |
 
setlocale(LC_ALL, 'ja_JP.UTF-8');                                              |
 
                                                                                |
 
$result = mysql_query("SELECT * FROM kanto order by number");                  |
 
                                                                                |
 
                                                                                |
 
$i = 0;                                                                        |
 
$offset = 330;                                                                  |
 
                                                                                |
 
print "<table border=1 width=\"330\" height=\"700\" style=\"position: absolute; margin-left: 0; margin-bottom: 10px\">\n";
 
print "<tr><td>Pokédex Number</td><td>Hex Value</td><td>Sprite</td><td>Name</td></tr>";
 
                                                                                |
 
$sort = $_GET["sort"];                                                          |
 
                                                                                |
 
if ($sort=="1")                                                                |
 
  $result = mysql_query("SELECT * FROM kanto order by hex");                    |
 
                                                                                |
 
else if ($sort=="2")                                                            |
 
  $result = Mysql_query("SELECT * FROM kanto order by engName");                |
 
                                                                                |
 
                                                                                |
 
while($row = mysql_fetch_array($result))                                        |
 
  {                                                                            |
 
    $get = $i + 1;                                                              |
 
                                                                                |
 
    if ($i % 9 == 0 && $i != 0)                                                |
 
      {                                                                        |
 
        print "</table>";                                                      |
 
                                                                                |
 
        if ($offset % 660 == 0 && $offset != 0)                                |
 
          {                                                                    |
 
            print "<table border=\"1\" width=\"330\" height=\"700\"  style=\"margin-left: $offset; margin-bottom: px\">\n";
 
            $offset = 0;                                                        |
 
          }                                                                    |
 
                                                                                |
 
        else                                                                    |
 
          {                                                                    |
 
            print "<table border=\"1\" width=\"330\" height=\"700\" style=\"position: absolute; margin-left: $offset\">\n";
 
            $offset = $offset + 330;                                            |
 
          }                                                                    |
 
                                                                                |
 
        print "<tr><td>Pokédex Number</td><td>Hex Value</td><td>Sprite</td><td>Name</td></tr>";
 
      }                                                                        |
 
                                                                                |
 
    print "<tr>\n";                                                            |
 
                                                                                |
 
    print "<td>".$row['number'] ."</td>";                                      |
 
                                                                                |
 
    print "<td>" . $row['hex']  . "</td>";                                      |
 
                                                                                |
 
    print "<td><img src=\"pics/" . $row['engName']  . ".png\" height=50 width=50 /></td> ";
 
                                                                                |
 
    print "<td><a href=\"getPokemonSQL.php?zukan=" . $row['number']  . "\" >" . $row['engName']  . "</a></td>\n";
 
                                                                                |
 
    print "</tr>\n";                                                            |
 
                                                                                |
 
                                                                                |
 
    /*    echo $row['number'] . " " . $row['engName'];                          |                                                                                                                       
 
    echo "<br />";                                                              |                                                                                                                       
 
    */                                                                          |
 
    $i++;                                                                      |
 
  }                                                                            |
 
                                                                                |
 
  print "</table>\n";                                                          |
 
                                                                                |
 
mysql_close($con);                                                              |
 
?>
 

Latest revision as of 20:09, 20 November 2012

This is for testing