Inserimento Dati Utente in 2 tabelle diverse
Salve Ragazzi sono qui per chiedervi 1 aiuto:
Io ho 1 sito che sfrutta 1 sistema log_in differente dal forum che è phpbb,a me serve fare in modo che l'utente possa registrarsi sia al sito che al foro in1 sola pagina creata da me!
Avevo buttato 1 script giu oggi che pero non mi funziona ,non è che mi dareste 1 mano?
Con questi form invio i dati...
Codice HTML:
<form name="form1" action="ProvaReg.php" method="get">
<html>
<head>
<meta http-equiv="Content-Language" content="it">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Nuova pagina 3</title>
</head>
<body>
<p> </p>
<table border="1" width="357" height="229">
<tr>
<td height="19" width="357" colspan="2">
<p align="center">Sito</td>
</tr>
<tr>
<td height="21" width="127">Nik</td>
<td height="21" width="214">
<input type="text" name="username" id="username"></td>
</tr>
<tr>
<td height="17" width="127">Pass</td>
<td height="17" width="214">
<input type="text" name="user_password" id="user_password"></td>
</tr>
<tr>
<td height="18" width="127">Email</td>
<td height="18" width="214">
<input type="text" name="user_email" id="user_email"></td>
</tr>
<tr>
<td height="18" width="341" colspan="2">
<p align="center">Forum</td>
</tr>
<tr>
<td height="18" width="127">Nik</td>
<td height="18" width="214">
Vale Quello sopra:....</td>
</tr>
<tr>
<td height="17" width="127">Pass</td>
<td height="17" width="214">
<input type="text" name="password" id="password"></td>
</tr>
<tr>
<td height="19" width="127">Email</td>
<td height="19" width="214">
<input type="text" name="mail" id="mail"></td>
</tr>
<tr>
<td height="21" width="127">Conferma</td>
<td height="21" width="214">
<input type="submit" name="submit" value="Invia" id="submit"> <input type="reset" name="reset" value="Cancella"></td>
</tr>
</table>
</body>
</html>
Con questo li salvo nel database:
Codice PHP:
<?php
$user = "";
$pwd = ""; // qui la tua password
$host = "localhost";
$dbase = "my_";
$db = mysql_connect ($host, $user, $pwd) or die
("Impossibile connettersi al database!");
mysql_select_db ($dbase);
$username = $_GET['username'];
$user_password = $_GET['user_password'];
$user_email = $_GET['user_email'];
$password = $_GET['password'];
$mail = $_GET['mail'];
if ($_GET['submit'] == 'Invia') {
mysql_query ("INSERT INTO phpbb_users (username, user_password, user_email) VALUES ('$username', '$user_password', '$user_email')") or die("Errore nell'inserimento!");
mysql_query ("INSERT INTO sl_user (username, password, mail) VALUES ('$username', '$password', '$mail')") or die("Errore nell'inserimento2!");
echo ("Inserimento avvenuto correttamente!"); }
?>
L' errore che mi da è Errore nell'Inserimento!
Mi sapreste aiutare per piacere?
Ps. le 2 tabelle si chiamano phpbb_users e sl_user ovviamente hanno il nome dei campi diversi ,percio ho fatto+form e messo nomi diversi (esempio:user_password per phpbbe password per sl_user)
Vi prego aiutatemi
Ps2 spero di aver scritto in modo conprensibile