Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]ShoutBox, mysql_fetch_row(): supplied argument is not a valid MySQL result ...
blacki
post 24.10.2009, 16:50:17
Post #1





Grupa: Zarejestrowani
Postów: 81
Pomógł: 0
Dołączył: 12.08.2009

Ostrzeżenie: (10%)
X----


Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in c:\usr\krasnal\www\nowy folder\get_data.php on line 7

oto linia 7:
  1. while($r = mysql_fetch_row($q)){


gdzie jest tu błąd?
Go to the top of the page
+Quote Post
piotrooo89
post 24.10.2009, 16:52:13
Post #2


Newsman


Grupa: Moderatorzy
Postów: 4 005
Pomógł: 548
Dołączył: 7.04.2008
Skąd: Trzebinia/Kraków




nie ty tylko w mysql_query. zastosuje mysql_error() do sprawdzenia błędu.


--------------------
Go to the top of the page
+Quote Post
blacki
post 24.10.2009, 16:59:19
Post #3





Grupa: Zarejestrowani
Postów: 81
Pomógł: 0
Dołączył: 12.08.2009

Ostrzeżenie: (10%)
X----


Nie do końca rozumiem, oto cały kod:
  1. <?php
  2. include("config.php");
  3. $db = @mysql_connect($sql_serwer,$sql_user,$sql_pass);
  4. @mysql_select_db($sql_baza);
  5.  
  6. $q = mysql_query("SELECT * FROM `shoutbox` ORDER BY `data` DESC LIMIT $iloscWpisow");
  7. while($r = mysql_fetch_row($q)){
  8. ?>
  9. <div id="wpis">
  10. <strong>Nick: </strong><?php echo $r[1];?><br />
  11. <p class="tresc"><?php echo $r[2];?></p>
  12. <hr noshade="noshade" size="1" width="90%" />
  13. <p class="data"><?php echo $r[3];?></p>
  14. </div>
  15. <?php
  16. }
  17. ?>


Co powinienem zmienić?
Go to the top of the page
+Quote Post
piotrooo89
post 24.10.2009, 17:09:09
Post #4


Newsman


Grupa: Moderatorzy
Postów: 4 005
Pomógł: 548
Dołączył: 7.04.2008
Skąd: Trzebinia/Kraków




  1. include("config.php");
  2. $db = mysql_connect($sql_serwer,$sql_user,$sql_pass);
  3. mysql_select_db($sql_baza);
  4.  
  5. $q = mysql_query("SELECT * FROM `shoutbox` ORDER BY `data` DESC LIMIT $iloscWpisow") or die(mysql_error());
  6. while($r = mysql_fetch_row($q))
  7. {
  8. echo '<div id="wpis">
  9. <strong>Nick: </strong>'.$r[1].'<br />
  10. <p class="tresc">'.$r[2].'</p>
  11. <hr noshade="noshade" size="1" width="90%" />
  12. <p class="data">'.$r[3].'</p>
  13. </div>;'
  14. }


co się dzieje?


--------------------
Go to the top of the page
+Quote Post
blacki
post 24.10.2009, 17:16:38
Post #5





Grupa: Zarejestrowani
Postów: 81
Pomógł: 0
Dołączył: 12.08.2009

Ostrzeżenie: (10%)
X----



Parse error: parse error, expecting `','' or `';'' in c:\usr\krasnal\www\nowy folder\get_data.php on line 15
Go to the top of the page
+Quote Post
Blame
post 24.10.2009, 17:20:02
Post #6





Grupa: Zarejestrowani
Postów: 678
Pomógł: 124
Dołączył: 26.09.2009

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


  1. include("config.php");
  2. $db = mysql_connect($sql_serwer,$sql_user,$sql_pass);
  3. mysql_select_db($sql_baza);
  4.  
  5. $q = mysql_query("SELECT * FROM `shoutbox` ORDER BY `data` DESC LIMIT $iloscWpisow") or die(mysql_error());
  6. while($r = mysql_fetch_row($q))
  7. {
  8. echo '<div id="wpis">
  9. <strong>Nick: </strong>'.$r[1].'<br />
  10. <p class="tresc">'.$r[2].'</p>
  11. <hr noshade="noshade" size="1" width="90%" />
  12. <p class="data">'.$r[3].'</p>
  13. </div>';
  14. }

Teraz spróbuj.


--------------------
Go to the top of the page
+Quote Post
blacki
post 24.10.2009, 17:22:01
Post #7





Grupa: Zarejestrowani
Postów: 81
Pomógł: 0
Dołączył: 12.08.2009

Ostrzeżenie: (10%)
X----


Okej teraz sprawne... musze jeszcze baze danych podstawić... dzięki winksmiley.jpg
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: 13.07.2025 - 20:14