...

View Full Version : Help on inserting values into 2 tables at once



crays
05-17-2008, 01:24 PM
Hi, i need help again x(. I'm trying to put 2 different values into 2 different tables upon registration. The script works fine and redirect out but no sign of record is shown on my database.



if ($Pass == $Pass2) {
$user = mysql_query("SELECT * FROM user WHERE (username='$bang')");
if (mysql_num_rows($user) > 0) {
?>
<script type="text/javascript">
alert("Sorry, Username taken!");
history.back();
</script>
<?php
}
else {
$user = mysql_query(
"INSERT INTO user (username, password, mail) VALUES ('$name','$pass','$email')");
$user = mysql_query(
"INSERT INTO winer (uname, clock) VALUES ('$name','ii')"
);
Header("Location:http://redirected.site");
}
}
else {
?>
<script type="text/javascript">
alert("Your Password did not match!");
history.back();
</script>
<?php
}
?>

abduraooft
05-17-2008, 03:00 PM
Try to see any errors in your query by

$user = mysql_query("INSERT INTO user (username, password, mail) VALUES ('$name','$pass','$email')") or die(mysql_error());
$user = mysql_query(
"INSERT INTO winer (uname, clock) VALUES ('$name','ii')" ) or die(mysql_error());

Also make sure that error reporting is turned ON.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum