- This topic is empty.
May 11, 2015 at 4:15 pm #202006
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();
$message= "Register complete";May 11, 2015 at 9:19 pm #202014bochristensenParticipant
die("Could not insert your information");
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.phpMay 12, 2015 at 3:29 am #202033
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”May 12, 2015 at 2:18 pm #202086
I’m barely getting the grip of PHP though… So it’d be pretty hard to get ahold of a different API…May 12, 2015 at 3:03 pm #202089
Yes, but there’s no where even close to as many tutorials for PDO or MySQLi as there is regular PHP.May 14, 2015 at 6:03 am #202172AnonymousInactive
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.May 17, 2015 at 8:48 am #202468drose379Participant
@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.
- The forum ‘Back End’ is closed to new topics and replies.