cs1h Posted September 26, 2007 Share Posted September 26, 2007 Hi, I have a registration form for my site but its not uploading the information to the database, but it is saying that the information is being loaded but when I check its not there. I can't work out whats wrong with it. The script is <?php include("config.php"); $targetb = $_POST['menuFilesDMA']; $targetb = str_replace(' ','_', $targetb); // connect to the mysql server $link = mysql_connect($server, $db_user, $db_pass) or die ("Could not connect to mysql because ".mysql_error()); // select the database mysql_select_db($database) or die ("Could not select database because ".mysql_error()); // check if the username is taken $check = "select id from $table where username = '".$_POST['username']."';"; $qry = mysql_query($check) or die ("Could not match data because ".mysql_error()); $num_rows = mysql_num_rows($qry); if ($num_rows != 0) { echo "Sorry, there the username $username is already taken.<br>"; echo "<a href=register.html>Try again</a>"; exit; } else { // insert the data $insert = mysql_query("insert into `ac_users` (`username`, `password`, `name1`, `origin`, `email`, `horde`) values ('$username', '$password', '$name1', '$targetb', '$day-$month-$year', '$horde')") or die("Could not insert data because ".mysql_error()); // print a success message echo "Your user account has been created!<br>"; echo "Now you can <a href=index.html>log in</a>"; } ?> All help is much appriciated, Thanks Colin Quote Link to comment https://forums.phpfreaks.com/topic/70753-solved-information-not-going-into-databse/ Share on other sites More sharing options...
HuggieBear Posted September 26, 2007 Share Posted September 26, 2007 Where are you setting $table? It's not in this file. Also, you don't need the semi colon here: $check = "select id from $table where username = '".$_POST['username']."';"; Regards Huggie Quote Link to comment https://forums.phpfreaks.com/topic/70753-solved-information-not-going-into-databse/#findComment-355667 Share on other sites More sharing options...
cs1h Posted September 26, 2007 Author Share Posted September 26, 2007 I changed the $table so that it is in there and doesn't have to be got from a seperate file. The proccessor is uploading the origin and nothing else. Any ideas why? Thanks Colin Quote Link to comment https://forums.phpfreaks.com/topic/70753-solved-information-not-going-into-databse/#findComment-355733 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.