Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Could not insert your information, php user registration

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #202006
    ErraticFox
    Participant

    So I keep getting “Could not insert your information” upon registering… I’ve spell checked everything a dozen times…

    Here is my snippet:

    $ip_address = $_SERVER['REMOTE_ADDR'];
    $query = mysql_query("INSERT INTO members (username, firstname, lastname, email, password, ip_address, sign_up_date) VALUES ('$username', '$fname', '$lname', '$email', '$pass1', $ip_address', now())")or die("Could not insert your information");
    $member_id = mysql_insert_id();
    mkdir("users/$member_id",0755);
    $message= "Register complete";

    #202014
    bochristensen
    Participant

    Change:
    die("Could not insert your information");

    To:
    die("Could not insert your information." . mysql_error());

    And show copy paste the error message in here.

    Besides that you should be using MySQLi or PDO_MySQL.
    Read more here: http://php.net/manual/en/function.mysql-query.php

    #202033
    ErraticFox
    Participant

    My full code can be found at: http://pastebin.com/Xcd4qfrD

    Also it reports with an error of: “You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘.132.89′, now())’ at line 1”

    #202086
    ErraticFox
    Participant

    I’m barely getting the grip of PHP though… So it’d be pretty hard to get ahold of a different API…

    #202089
    ErraticFox
    Participant

    Yes, but there’s no where even close to as many tutorials for PDO or MySQLi as there is regular PHP.

    #202172
    Anonymous
    Inactive

    Yes, but there’s no where even close to as many tutorials for PDO or MySQLi as there is regular PHP.

    1) PDO and MySQLi are both regular PHP. PDO’s manual page can be found here: http://php.net/manual/en/book.pdo.php

    2) Even if there are fewer of them, the PDO tutorials are likely better quality than those that use the deprecated mysql functions.

    3) Exposing your users to insecure code because the alternative is harder to learn is not a professional approach. If you don’t understand how to protect your users’ data, then either take the time to get it right, pay someone who does, or lose the feature.

    #202468
    drose379
    Participant

    @ErraticFox Let me know if you wanna see some really basic examples of PDO, its way easier to understand then it looks. Just a few simple examples could get you moving in the right direction. Listen to the experts, mysql_ functions are deprecated because they are not secure. PDO is the way to go, better to learn the better way at the beginning rather then getting to comfortable with the incorrect way.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Back End’ is closed to new topics and replies.