Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> co w tym jets zle?
Fistach
post 30.06.2004, 14:40:24
Post #1





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

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


najprostszy przyklad a ciagle wywala mi bledy:
  1. <?
  2.  
  3. $conn=mysql_connect(&#092;"localhost\", \"user\", \"haslo\") or die ('I cannot connect to the database because: ' . mysql_error());
  4. mysql_select_db(&#092;"lotr_base\", $conn);
  5.  
  6. $total = mysql_result(mysql_query(&#092;"SELECT COUNT(id) FROM e_mail\"),0);
  7.  
  8. print &#092;"<font color=red>W sumie: $total</font>\";
  9.  
  10. ?>


Ciagle wywala blad: Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/lotr/public_html/subscribe.php on line 11

a powinno wyswietlic: 1
Go to the top of the page
+Quote Post
FastRed
post 30.06.2004, 15:02:01
Post #2





Grupa: Zarejestrowani
Postów: 79
Pomógł: 0
Dołączył: 30.06.2003
Skąd: Chełm

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


SPróbuj tak:
  1. <?php
  2.  
  3. $conn=mysql_connect(&#092;"localhost\", \"user\", \"haslo\") or die ('I cannot connect to the database because: ' . mysql_error());
  4. mysql_select_db(&#092;"lotr_base\", $conn);
  5. $resResult = mysql_query('SELECT COUNT(id) FROM e_mail');
  6. $total = mysql_result($resResult, 0);
  7.  
  8. print &#092;"<font color=red>W sumie: $total</font>\";
  9.  
  10. ?>
Go to the top of the page
+Quote Post
Fistach
post 30.06.2004, 15:05:39
Post #3





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

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


nei dziala tak - juz probowalem:/ probowalem tez z mysql_num_rows i tez nie dzialalo:( Nie wiem co jest - siedze juz nad tym ze 3 godziny
Go to the top of the page
+Quote Post
dr_bonzo
post 30.06.2004, 15:21:24
Post #4





Grupa: Przyjaciele php.pl
Postów: 5 724
Pomógł: 259
Dołączył: 13.04.2004
Skąd: N/A

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


Cytat
Warning: mysql_result(): supplied argument is not a valid MySQL result resource

czyli argument w funkcji mysql_result nie jest prawidlowy, a argumentem jest:
  1. <?php
  2. mysql_query(&#092;"SELECT COUNT(id) FROM e_mail\"),0);
  3. ?>

Sprawdz czy czasem mysql_query nie zwraca FALSE


--------------------
Nie lubię jednorożców.
Go to the top of the page
+Quote Post
Fistach
post 30.06.2004, 15:35:39
Post #5





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

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


Dzieki juz zrobilem i dziala wszystko!

Ten post edytował Fistach 30.06.2004, 16:59:26
Go to the top of the page
+Quote Post
rzseattle
post 30.06.2004, 19:48:07
Post #6





Grupa: Przyjaciele php.pl
Postów: 554
Pomógł: 0
Dołączył: 4.04.2002
Skąd: Tychy

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


php => php Poczatkujacy


--------------------
"Real children don't go hoppity-skip unless they are on drugs."
Go to the top of the page
+Quote Post

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: 14.08.2025 - 11:50