Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP] sprawdź czy element istnieje jeżeli nie to dodaj
gregi
post
Post #1





Grupa: Zarejestrowani
Postów: 100
Pomógł: 0
Dołączył: 11.09.2003

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


Potrzebuje wsparcia, ponieważ nie mogę rozwiązać zagadki jak to ugryźć

  1. class porównaj
  2. {
  3. function __construct($tabela1,$tabela2,tabela3)
  4.  
  5. $result = mysql_query("SELECT id_film FROM $tabela1 WHERE id_film ");
  6. $result2 = mysql_query("SELECT id_film FROM $tabela2 WHERE id_film ");
  7. $result3 = mysql_query("SELECT id_film FROM $tabela2 WHERE id_film ");
  8.  
  9. $row = mysql_fetch_array($result, MYSQL_ASSOC);
  10.  
  11. while (!empty($row[id_film]) )
  12. {
  13. sprawdź czy każdy element z tabeli1 jest w tabeli 2, jeżeli jest to dodaj do tabeli 3 pod warunkiem że tam go nie ma( w tabeli 3):)
  14.  
  15. }
  16. }


Ten post edytował gregi 5.02.2015, 17:53:11
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
gregi
post
Post #2





Grupa: Zarejestrowani
Postów: 100
Pomógł: 0
Dołączył: 11.09.2003

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


if(mysql_num_rows($result2)==1){
nie jest jasny dla mnie ten warunek ==1

var_dump ($result2) zwraca warość np. resource(19) of type (mysql result)
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: 6.10.2025 - 14:59