Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> php/mysql ta wama watrość auto_increment e dwóch kolumnach
itson
post
Post #1





Grupa: Zarejestrowani
Postów: 40
Pomógł: 0
Dołączył: 3.01.2007

Ostrzeżenie: (0%)
-----


mam tabelę a w niej kolumnę id z wartością auto_increment jak zrobić aby w kolumnie pass była ta sama wartość co w kolumnie id

ps. oczywiście mógłbym zrobić INSERT odczytać wartość auto_increment za pomocą mysql_insert_id() i UPDATE ale zależy mi na tym aby to było w jednym zapytaniu mysql-a
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
itson
post
Post #2





Grupa: Zarejestrowani
Postów: 40
Pomógł: 0
Dołączył: 3.01.2007

Ostrzeżenie: (0%)
-----


tabela:

user_id int(11) NOT NULL auto_increment,
email varchar(255) NOT NULL default '',
passwd varchar(50) NOT NULL default '',
name varchar(100) NOT NULL default '',
access_lvl tinyint(4) NOT NULL default '1',
login varchar(20) NOT NULL default '',
fname varchar(20) NOT NULL default '',
sname varchar(20) NOT NULL default '',
adres varchar(100) NOT NULL default '',
woj varchar(30) NOT NULL default '',
city varchar(30) NOT NULL,
data_ur varchar(30),
PRIMARY KEY (user_id),
UNIQUE KEY uniq_email (email)

dodawanie danych do tabeli:

$sql = "INSERT INTO ssb_users (email, sname, fname, login, woj, city, adres, data_ur, passwd) " .
"VALUES ('" . $_POST['email'] . "','" .$_POST['sname'] . "','" . $_POST['fname'] . "','" . $_POST['sname'] . "', '" . $_POST['woj'] . "','" . $_POST['city'] . "', '" . $_POST['adres'] . "', '" .implode("-",$_POST['data'] ). "', ' tu bym chciał mieć tą samą wartość co w polu user_id' )";
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 10.10.2025 - 02:43