Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MYSQL]/[PHP], Błąd Select Max
InzaghiX
post
Post #1





Grupa: Zarejestrowani
Postów: 24
Pomógł: 0
Dołączył: 20.01.2008

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


Witam, mam taki problem odnośnie wyświetlenia wartości maksymalnej z kolumny gdy wyświetlam kod

  1. <?php
  2. $sql2 = "SELECT (id_film) FROM filmy";
  3. $result2 = mysql_query($sql2) or die( mysql_error() );
  4. while ($row = mysql_fetch_array($result2) )
  5.  echo "$row[id_film]<br/>";
  6.  mysql_free_result($result2);
  7. ?>


A jak chce zrobić aby wyświetliło maksymalna wartość kolumny i powiększyło ją o 1 w góre to nic nie wyświetla

  1. <?php
  2. $sql2 = "SELECT MAX(id_film)+1 FROM filmy";
  3. $result2 = mysql_query($sql2) or die( mysql_error() );
  4. while ($row = mysql_fetch_array($result2) )
  5.  echo "$row[id_film]<br/>";
  6.  mysql_free_result($result2);
  7. ?>
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 Aktualny czas: 21.08.2025 - 07:18