1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

wamp problems

Discussion in 'Databases' started by justin8831, Oct 22, 2015.

  1. #1
    <?php
    $db_conx = mysqli_connect ("localhost", "lol", ";imelife", "tommy");
    // returns error
    if (mysqli_connect_ernor() ) { echo mysqli_connect_error(); exit();}
    //if sucess
    else { echo "success db conx" ; }

    ?>
    I'm getting

    Fatal error: Call to undefined function mysqli_connect_ernor() in C:\wamp\www\root\php_includes\db_conx.php on line5
    Call Stack
    #
    Time Memory Function Location
    1 0.0253 238784 {main}( ) ..\db_conx.php:0
    SEMrush

    I'm using MySQL on wamp my files are saved to my desktop not in any wamp folder I'm using dreamweaver and dw is using wamp to show the site live
     
    justin8831, Oct 22, 2015 IP
    SEMrush
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,630
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    Uhm... You have two typos in that bit of code alone... First, the ; in the db connection, then mysqli_connect_ernor instead of mysqli_connect_error - this should be fairly obviousobvious, and if you used a proper editor, it would show you that the function call wasn't valid. Also, the error message pretty much tells you what is wrong.
     
    PoPSiCLe, Oct 22, 2015 IP
  3. justin8831

    justin8831 Member

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #3
    thank you I'm learning and the guy on the tut used ernor
     
    justin8831, Oct 22, 2015 IP
  4. justin8831

    justin8831 Member

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #4
    man I love you ... no homo 8 hours and that was it I swear its hard to learn from youtube
     
    justin8831, Oct 22, 2015 IP
  5. justin8831

    justin8831 Member

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #5
    <?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_video = "CREATE TABLE IF NOT EXISTS video (
    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_video);
    if ($query === TRUE) {
    echo "<h3>video table created OK :) </h3>";
    } else {
    echo "<h3>video 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>";
    }

    ?>
     
    justin8831, Oct 22, 2015 IP
  6. justin8831

    justin8831 Member

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #6
    its all coming back with errors @PoPSiCLe I don't know what I did wrong when u correct my errors I learn so teach please sir


     
    justin8831, Oct 22, 2015 IP
  7. justin8831

    justin8831 Member

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #7
    also when I try to copy past the error I'm getting it tells me I'm using a redirect and cant post
     
    justin8831, Oct 22, 2015 IP
  8. justin8831

    justin8831 Member

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #8

    Warning: include_once(php_includes/db_conx.php): failed to open stream: No such file or directory in C:\wamp\www\make_my_tables.php on line2

    Warning: include_once(): Failed opening 'php_includes/db_conx.php' for inclusion (include_path='.;C:\php\pear') in C:\wamp\www\make_my_tables.php on line2
    Notice: Undefined variable: db_conx in C:\wamp\www\make_my_tables.php on line22

    Warning: mysqli_query() expects parameter 1 to be mysqli, null given in C:\wamp\www\make_my_tables.php on line22

    Notice: Undefined variable: db_conx in C:\wamp\www\make_my_tables.php on line38

    Warning: mysqli_query() expects parameter 1 to be mysqli, null given in C:\wamp\www\make_my_tables.php on line38


    the error msg just repeats its self over and over for each table so whatever I did wrong I have to fix the same problem everywhere
     
    justin8831, Oct 22, 2015 IP
  9. justin8831

    justin8831 Member

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #9
    fixed it myself by changing file path of includes lol
     
    justin8831, Oct 22, 2015 IP
  10. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,630
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #10
    Good for you! :) Learning by doing is often the best way to get better.
     
    PoPSiCLe, Oct 23, 2015 IP