Advertisement
smashapps

ep_tables

Jul 8th, 2014
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.37 KB | None | 0 0
  1. <?php
  2. //Create tables here
  3.  
  4. $table_prefix = $_POST['ep-tbprefix'];
  5.  
  6. $dbHost = $_POST[''];
  7. $dbUsername = $_POST[''];
  8. $dbPassword = $_POST[''];
  9. $dbDatabase = $_POST[''];
  10.  
  11. //Connect
  12. $connection=mysqli_connect('$dbHost', '$dbUsername', '$dbPassword', '$dbDatabase');
  13. if (mysqli_connect_errno()) {
  14.   echo "Failed to connect to MySQL: " . mysqli_connect_error();
  15. }
  16.  
  17. $sql = "CREATE TABLE ep_users(
  18.     user_id INT NOT NULL AUTO_INCREMENT,PRIMARY KEY(user_id),
  19.     user_login_name VARCHAR(60),
  20.     user_display_name VARCHAR(60),
  21.     user_password VARCHAR(60),
  22.     user_password_salt VARCHAR(60),
  23.     user_email VARCHAR(100),
  24.     user_registration_date datetime,
  25.     user_role VARCHAR(10),
  26.     ";
  27.    
  28. $sql .= "CREATE TABLE ep_options(
  29.     option_id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(option_id),
  30.     option_name LONGTEXT,
  31.     option_value LONGTEXT";
  32.  
  33. //Now execute our query's
  34.  
  35. if (mysqli_multi_query($connection, $sql)) {
  36.     do {
  37.         //Store first result set
  38.         if ($result = mysqli_store_result($connection)) {
  39.             while ($row = mysqli_fetch_row($result)) {
  40.                 printf("%s\n", $row[0]);
  41.             }
  42.             mysqli_free_result($result);
  43.         }
  44.         //Print divider
  45.         if (mysqli_more_results($connection)) {
  46.             printf("-----------------\n");
  47.         }
  48.     } while (mysqli_next_result($connection));
  49. }
  50.  
  51. mysqli_close($connection);
  52. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement