Jump to content
djclewes

help with create tables

Recommended Posts

hi this php script is not working for me.

 

 

 

<?php include_once("php_includes/db_conx.php"); $tbl_users = "CREATE TABLE IF NOT EXISTS users ( id INT(11) NOT NULL AUTO_INCREMENT, username VARCHAR(16) NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, gender ENUM('m','f') NOT NULL, website VARCHAR(255) NULL, country VARCHAR(255) NULL, userlevel ENUM('a','b','c','d') NOT NULL DEFAULT 'a', avatar VARCHAR(255) NULL, ip VARCHAR(255) NOT NULL, signup DATETIME NOT NULL, lastlogin DATETIME NOT NULL, notescheck DATETIME NOT NULL, activated ENUM('0','1') NOT NULL DEFAULT '0', PRIMARY KEY (id), UNIQUE KEY username (username,email) )"; $query = mysqli_query($db_conx, $tbl_users); if ($query === TRUE) { echo "<h3>user table created OK </h3>"; } else { echo "<h3>user table NOT created </h3>"; } //////////////////////////////////// $tbl_useroptions = "CREATE TABLE IF NOT EXISTS useroptions ( id INT(11) NOT NULL, username VARCHAR(16) NOT NULL, background VARCHAR(255) NOT NULL, question VARCHAR(255) NULL, answer VARCHAR(255) NULL, PRIMARY KEY (id), UNIQUE KEY username (username) )"; $query = mysqli_query($db_conx, $tbl_useroptions); if ($query === TRUE) { echo "<h3>useroptions table created OK </h3>"; } else { echo "<h3>useroptions table NOT created </h3>"; } //////////////////////////////////// $tbl_friends = "CREATE TABLE IF NOT EXISTS friends ( id INT(11) NOT NULL AUTO_INCREMENT, user1 VARCHAR(16) NOT NULL, user2 VARCHAR(16) NOT NULL, datemade DATETIME NOT NULL, accepted ENUM('0','1') NOT NULL DEFAULT '0', PRIMARY KEY (id) )"; $query = mysqli_query($db_conx, $tbl_friends); if ($query === TRUE) { echo "<h3>friends table created OK </h3>"; } else { echo "<h3>friends table NOT created </h3>"; } //////////////////////////////////// $tbl_blockedusers = "CREATE TABLE IF NOT EXISTS blockedusers ( id INT(11) NOT NULL AUTO_INCREMENT, blocker VARCHAR(16) NOT NULL, blockee VARCHAR(16) NOT NULL, blockdate DATETIME NOT NULL, PRIMARY KEY (id) )"; $query = mysqli_query($db_conx, $tbl_blockedusers); if ($query === TRUE) { echo "<h3>blockedusers table created OK </h3>"; } else { echo "<h3>blockedusers table NOT created </h3>"; } //////////////////////////////////// $tbl_status = "CREATE TABLE IF NOT EXISTS status ( id INT(11) NOT NULL AUTO_INCREMENT, osid INT(11) NOT NULL, account_name VARCHAR(16) NOT NULL, author VARCHAR(16) NOT NULL, type ENUM('a','b','c') NOT NULL, data TEXT NOT NULL, postdate DATETIME NOT NULL, PRIMARY KEY (id) )"; $query = mysqli_query($db_conx, $tbl_status); if ($query === TRUE) { echo "<h3>status table created OK </h3>"; } else { echo "<h3>status table NOT created </h3>"; } //////////////////////////////////// $tbl_photos = "CREATE TABLE IF NOT EXISTS photos ( id INT(11) NOT NULL AUTO_INCREMENT, user VARCHAR(16) NOT NULL, gallery VARCHAR(16) NOT NULL, filename VARCHAR(255) NOT NULL, description VARCHAR(255) NULL, uploaddate DATETIME NOT NULL, PRIMARY KEY (id) )"; $query = mysqli_query($db_conx, $tbl_photos); if ($query === TRUE) { echo "<h3>photos table created OK </h3>"; } else { echo "<h3>photos table NOT created </h3>"; } //////////////////////////////////// $tbl_notifications = "CREATE TABLE IF NOT EXISTS notifications ( id INT(11) NOT NULL AUTO_INCREMENT, username VARCHAR(16) NOT NULL, initiator VARCHAR(16) NOT NULL, app VARCHAR(255) NOT NULL, note VARCHAR(255) NOT NULL, did_read ENUM('0','1') NOT NULL DEFAULT '0', date_time DATETIME NOT NULL, PRIMARY KEY (id) )"; $query = mysqli_query($db_conx, $tbl_notifications); if ($query === TRUE) { echo "<h3>notifications table created OK </h3>"; } else { echo "<h3>notifications table NOT created </h3>"; } ?>

 

just wont create tbles.

 

here is the db php code. not my database details these are default ones

 

 

<?php $db_conx = mysqli_connect("localhost", "worldoi5_adam", "xxxxxxxx", "worldoi5_social"); // Evaluate the connection if (mysqli_connect_errno()) { echo mysqli_connect_error(); exit(); } else { echo "Successful database connection, happy coding!!!"; } ?>

 

Share this post


Link to post
Share on other sites

Make a better job of the presentation of your code then maybe someone will have a look at it.

Share this post


Link to post
Share on other sites

its ok i done it but in future how am i ment to do that. on other forums you have html buttons which you pu your code in and it makes it look as it does on note pad. on here you only have that feature i used above. also i am new.

Share this post


Link to post
Share on other sites

its ok i done it but in future how am i ment to do that. on other forums you have html buttons which you pu your code in and it makes it look as it does on note pad. on here you only have that feature i used above. also i am new.

 

You do it the same way you did in this post of yours 2 years ago

http://forums.phpfreaks.com/topic/287395-help-with-login-script-phphtml/?do=findComment&comment=1474436

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.