Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> 2 tabele, zapis danych do 2 tabel w jednej bazie
dekrzycho
post
Post #1





Grupa: Zarejestrowani
Postów: 39
Pomógł: 0
Dołączył: 10.01.2005

Ostrzeżenie: (10%)
X----


mam skrypt php ktory rejestruje mi delikwenta w bazie MySQL. jeśli gosc zaznaczy pole wyboru checkbox to chce aby mi adres email wpisal rowniez do drugiej tabeli. jesli robie wszystko dzial jesli gosc nie zaznaczy pola wyboru dane zostaja zapisane do tabeli users jesli zaznaczy to zapisuje email do tabeli newsletter ale nie users gdzie rowniez powinien!!!!
co zrobić. skrypt napisałem w ten sposób....

if (($row_duplicate['no_of_records']) != "0") {

// echo ("This email address is already present in our database. Please check you entered the correct address. If you have, you may have already registered and do not need to register again.");
echo ("<meta http-equiv=refresh content=0;url=register_all.php?&email=" . $email . "&classid=" . $classid . "&type=" . $type . "&errorcode=1>");
exit();

} else


{ // Register new user
$sql = "insert into users set
fullname='$fullname',
company='$company',
email='$email',
country='$country',
postcode='$postcode' ,
date=curdate()";
if ($pole=="on")
{
$sql = "insert into newsletter set
email='$email',
date=curdate()";


}
if (@mysql_query($sql))
{
// echo("Thank you for registering");
// echo($pageid);
// echo($title);

setcookie('solartronmobreydownloads',$email,time()+3600*24*365);
echo ("<meta http-equiv=refresh content=0;url=view_all.php?classid=" . $classid . "&type=" . $type . ">");

} else
{
echo ("Error registering user: " . mysql-error());

}

}
Go to the top of the page
+Quote Post

Posty w temacie
- dekrzycho   2 tabele   17.01.2005, 10:58:40
- - crash   Jeśli warunek $pole=="on" jest speł...   17.01.2005, 11:15:34
- - dekrzycho   hmm, wiesz ja nie mam pojecia o co w tym php chodz...   17.01.2005, 11:23:45


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 17:31