Advertisement
Guest User

Untitled

a guest
May 31st, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.20 KB | None | 0 0
  1. <html>
  2.                     <title>Basic Locations display from sql database</title>
  3. <body>
  4. <?php
  5.         //DB Info
  6.         $username="SQL_USER";
  7.         $password="SQL_PW";
  8.         $database="Database";
  9.         $host="IP";
  10.  
  11.  
  12.             //DB Connection or give and error.         
  13.             mysql_connect($host,$username,$password) or die( "Unable to to connect to host");
  14.  
  15.                 //Select Database or give and error.           
  16.                 @mysql_select_db($database) or die( "Unable to select database");
  17.                    
  18.                     //Select table.                
  19.                     $query="SELECT * FROM game_tele";
  20.  
  21.                 //Creating query to display result.
  22.                 $result=mysql_query($query);    //
  23.                 $num=mysql_numrows($result);    //
  24.                 mysql_close();          //
  25.                 // All say'When'itsused..                                          
  26.                    
  27.  
  28.             //This is the start of the display duh.. ;p
  29.             echo "<b><center>Locations your able to teleport</center></b><br><br>";
  30.  
  31.         //loops the script
  32.         $i=0;
  33.         while ($i < $num) {
  34.  
  35.  
  36.         //this creats the fuction to to grab the result from the query
  37.         $name=mysql_result($result,$i,"name");                      //
  38.         //'When', it was explained above. :)                        //
  39.  
  40.  
  41.     //This is the fucntion in use notice the HTML tags..                               
  42.     echo "<center><b>$name</b><br><hr>";
  43.  
  44. //end of looping
  45. $i++;
  46. }
  47.     //All done.
  48. ?>
  49. </body>
  50. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement