Difference between revisions of "Test:Test"

From OOUG
Jump to navigation Jump to search
(Created page with "This is for testing")
 
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);                                                              |
 +
?>

Revision as of 20:04, 20 November 2012

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 "

\n"; print "";
                                                                               |

$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 "
Pokédex NumberHex ValueSpriteName

"; |

                                                                               |
       if ($offset % 660 == 0 && $offset != 0)                                 |
         {                                                                     |

print "

\n"; $offset = 0; | } | | else | { | print "
\n"; $offset = $offset + 330; | } | | print "";
     }                                                                         |
                                                                               |
print "\n"; | | print ""; |
                                                                               |
print ""; |
                                                                               |
print " ";
                                                                               |
print "\n";
                                                                               |
print "\n"; | | | /* echo $row['number'] . " " . $row['engName']; | echo "
"; | */ | $i++; | } | | print "
Pokédex NumberHex ValueSpriteName
".$row['number'] ."" . $row['hex'] . "<img src=\"pics/" . $row['engName'] . ".png\" height=50 width=50 /><a href=\"getPokemonSQL.php?zukan=" . $row['number'] . "\" >" . $row['engName'] . "</a>

\n"; |

                                                                               |

mysql_close($con); | ?>