-
Posts
39 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by Colourtheory
-
-
-
-
-
-
SQL Double
in PHP
I fixed it by adding a check box that only lets the script run if it's checked, thanks for the help guys!
-
I'm just wondering if this is a good place for newbies, I am learning several languages, and have questions. Is this forum (not this section) only right for advanced people?
-
SQL Double
in PHP
Would adding NOT NULL to the values stop this?
-
SQL Double
in PHP
Oh, so even when it redirects it adds a record?
-
SQL Double
in PHP
I'm sending this post request. <form action="insert.php" method="post">Username:<br> <input class="register" type="text" name="username"><br>Lastname:<br> <input class="register" type="text" name="password"><br>Email:<br> <input class="register" type="text" name="email"><br>Age:<br><input class="register" type="text" name="age"<br><input type="submit"></form>
-
SQL Double
in PHP
It's not a public website I'm just trying to learn PHP and SQL.
-
SQL Double
in PHP
$con = mysql_connect(my sql information is here and works dont worry about that);if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("u486827913_accounts", $con); $sql="INSERT INTO Accounts (Username, Password, Email, Age)VALUES('$_POST[username]','$_POST[password]','$_POST','$_POST[age]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); }echo "1 record added"; mysql_close($con);?> </div></body>
-
SQL Double
in PHP
*Input box, it enters the users input and creates a SQL object with their information
-
SQL Double
in PHP
I have a box "register" thing which simply inserts a new object into my MySQL table, and it works- BUT it also creates a spare one which is completely blank and has no values or anything. I can give the source, just ask if required.
One last error, hopefully this is it
in PHP
Posted
For some reason, it always says that the password is incorrect. I have looked at everything, so I'm hoping that someone can help me <? //This function will find and checks if your data is correct //Collect your info from login form $username = $_REQUEST['username']; $password = $_REQUEST['password']; //Connecting to database $connect = mysql_connect("myhost", "myuser", "mypass"); if(!$connect){ die(mysql_error()); } //Selecting database $select_db = mysql_select_db("mydatabase", $connect); if(!$select_db){ die(mysql_error()); } //Find if entered data is correct $result = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'"); $row = mysql_fetch_array($result); $id = $row['id']; $select_user = mysql_query("SELECT * FROM users WHERE id='$id'"); $row2 = mysql_fetch_array($select_user); $user = $row2['username']; if($username != $user){ die("Username is wrong!"); } $pass_check = mysql_query("SELECT * FROM users WHERE username='$username' AND id='$id'"); $row3 = mysql_fetch_array($pass_check); $email = $row3['email']; $select_pass = mysql_query("SELECT * FROM users WHERE username='$username' AND id='$id' AND email='$email'"); $row4 = mysql_fetch_array($select_pass); $real_password = $row4['password']; if($password != $real_password){ die("Your password is wrong!"); } //Now if everything is correct let's finish his/her/its login session_register("username", $username); session_register("password", $password); echo "Welcome, ".$username." please continue on our <a href=index.php>Index</a>"; ?>