Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP]next auto_increment
laik_PHP
post 16.03.2011, 01:36:19
Post #1





Grupa: Zarejestrowani
Postów: 30
Pomógł: 0
Dołączył: 28.02.2010

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


Hej, da się jakoś odczytać jaki będzie kolejny numer z pola auto_increment jednym zapytaniem?

narazie mam to tak:

  1. function addPlace ($label, $gallery) {
  2. $GLOBALS["mysqli"] -> query("INSERT INTO tabela (label, gallery) VALUES ('$label', '$gallery')");
  3. return $GLOBALS["mysqli"] -> query("SELECT MAX(id) FROM tabela");
  4. }



a chciałbym coś podobnego:

  1. function addPlace ($label, $gallery) {
  2. return $GLOBALS["mysqli"] -> query("INSERT INTO tabela (label, gallery) VALUES ('$label', '$gallery') RETURN AUTO_INCREMENT");
  3. }


Ten post edytował laik_PHP 16.03.2011, 01:37:27
Go to the top of the page
+Quote Post

Posty w temacie


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 Wersja Lo-Fi Aktualny czas: 19.07.2025 - 08:35