Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <title>Basic Locations display from sql database</title>
- <body>
- <?php
- //DB Info
- $username="SQL_USER";
- $password="SQL_PW";
- $database="Database";
- $host="IP";
- //DB Connection or give and error.
- mysql_connect($host,$username,$password) or die( "Unable to to connect to host");
- //Select Database or give and error.
- @mysql_select_db($database) or die( "Unable to select database");
- //Select table.
- $query="SELECT * FROM game_tele";
- //Creating query to display result.
- $result=mysql_query($query); //
- $num=mysql_numrows($result); //
- mysql_close(); //
- // All say'When'itsused..
- //This is the start of the display duh.. ;p
- echo "<b><center>Locations your able to teleport</center></b><br><br>";
- //loops the script
- $i=0;
- while ($i < $num) {
- //this creats the fuction to to grab the result from the query
- $name=mysql_result($result,$i,"name"); //
- //'When', it was explained above. :) //
- //This is the fucntion in use notice the HTML tags..
- echo "<center><b>$name</b><br><hr>";
- //end of looping
- $i++;
- }
- //All done.
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement