Jump to content

[SOLVED] Insert into?


unidox

Recommended Posts

I made a register form and here is the code:

 

// Variables
$name = $_POST['name'];
$dname = $_POST['display_name'];
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
$age = $_POST['age'];
$dob = $_POST['dob'];
$country = $_POST['country'];
$location = $_POST['location'];
$website = $_POST['website'];
$aim = $_POST['aim'];
$msn = $_POST['msn'];
$yim = $_POST['yim'];
$icq = $_POST['icq'];
$info = $_POST['info'];
$games = $_POST['games'];
$interests = $_POST['interests'];

// Query
$q = mysql_query("SELECT * FROM `pcp_users` WHERE username = '$username' || email = '$email'");
$r = mysql_fetch_array($q);
if(($r['username'] == $username) || ($r['email'] == $email)) {
    header("Location: " . $site_url . "index.php?p=register&e=1");
}
if(($name == "") || ($dname == "") || ($username == "") || ($password == "") || ($email == "")) {
    header("Location: " . $site_url . "index.php?p=register&e=2");
}
mysql_query("INSERT INTO `pcp_users` (username,password,email,display,name,description,age,dob,country,location,interests,website,aim,msn,icq,yim,games) VALUES ('$username','$password','$email','$dname','$name','$info','$age','$dob','$country','$location','$interests','$website','$aim','$msn','$icq','$yim','$games')");

 

The problem is, when I try to register, nothing goes into the db. What am I doing wrong? Thanks

Link to comment
https://forums.phpfreaks.com/topic/74632-solved-insert-into/
Share on other sites

Put a die statement at the end of the query.

 

mysql_query("INSERT INTO `pcp_users` (username,password,email,display,name,description,age,dob,country,location,interests,website,aim,msn,icq,yim,games) VALUES ('$username','$password','$email','$dname','$name','$info','$age','$dob','$country','$location','$interests','$website','$aim','$msn','$icq','$yim','$games')")
or die(mysql_error());

Link to comment
https://forums.phpfreaks.com/topic/74632-solved-insert-into/#findComment-377240
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.