Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][MYSQL]Pytanko o Mysql
Diablico14
post
Post #1





Grupa: Zarejestrowani
Postów: 25
Pomógł: 0
Dołączył: 17.08.2008

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


Mam taki problem . Gdy chce dane z bazy mysql wyskaukje mi taki blad
"
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /var/www/sites/yoyo.pl/e/u/euzebia/index.php on line 12
"
i nie wiem od czego to jest .
Pomozcie!
Zamiescilem wszystko co SAM napisalem smile.gif
http://rapidshare.com/files/137989305/Blog.rar.html
Z gory THX blink.gif

Powód edycji: dodałem tagi (cysiaczek)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 14)
Cysiaczek
post
Post #2





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




Jeden post, a tyle błędów i wypaczeń... smile.gif

Po pierwsze - witaj na forum.
Po drugie - nie ten dział - następnym razem rozejrzyj się po forum i przeczytaj regulamin.
Po trzecie - wątpię, aby ktoś ściągał jakąś paczkę i ją rozpakowywał, potem szukał błędu. Szanuj Nasz czas i pokaż dokładnie ten fragment kodu, który powoduje błąd.
Po czwarte - uprzedzę fakty - użyj bbcode przy wklejaniu kodu.

Pozdrawiam.


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post
JoShiMa
post
Post #3





Grupa: Zarejestrowani
Postów: 1 374
Pomógł: 149
Dołączył: 1.03.2006

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


Po czwarte ten błąd oznacza najprawdopodobniej błąd w zapytaniu.


--------------------
Go to the top of the page
+Quote Post
Diablico14
post
Post #4





Grupa: Zarejestrowani
Postów: 25
Pomógł: 0
Dołączył: 17.08.2008

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


No dobra sory ;p
to tak wydaje mi sie ze blad tkwi w tym:
  1. <?php
  2. while($row = mysql_fetch_array ($result)) {
  3. if($validcat == $row['id']) {
  4. ?>

nastepnym razem bede uwazaj i dziekuje za rady jesli mozna prosze o przeniesienie teamtu smile.gif
Go to the top of the page
+Quote Post
JoShiMa
post
Post #5





Grupa: Zarejestrowani
Postów: 1 374
Pomógł: 149
Dołączył: 1.03.2006

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


A skąd się bierze zmienna $result?


--------------------
Go to the top of the page
+Quote Post
Cysiaczek
post
Post #6





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




Dobrze, pokaż jeszcze zapytanie, które jest wywoływane. Prawdopodobnie nie zwraca ono żadnych rekordów, które można wyświetlić i stąd ten błąd. Upewnij się, że zapytanie jest poprawne smile.gif

Pozdrawiam.

p.s Jest spacjalne bbcode do php - [ php]kod [ /php]


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post
Diablico14
post
Post #7





Grupa: Zarejestrowani
Postów: 25
Pomógł: 0
Dołączył: 17.08.2008

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


  1. <?php
  2.  
  3. require("konfiguracja.php");
  4.  
  5. if(isset($_GET['id']) == TRUE) {
  6. if(is_numeric($id) == FALSE) {
  7. $error = 1;
  8. }
  9.  
  10. if($error == 1) {
  11. header("Location: " . $config_basedir . "/wyswietlanie_kategorii.php");
  12. }
  13. else {
  14. $validcat = $_GET['id'];
  15. }
  16. }
  17. else {
  18. $validcat = 0;
  19. }
  20.  
  21. require("naglowek.php");
  22.  
  23. $sql = "SELECT * FROM kategorie";
  24.  
  25. $result = mysql_query($sql);
  26.  
  27. while($row = mysql_fetch_array ($result)) {
  28. if($validcat == $row['id']) {
  29. echo "<strong>" . $row['kat'] . "</strong><br />";
  30.  
  31. $entriessql = "SELECT * FROM `db505613`.`wpisy` WHERE id_kat = " . $validcat . " ORDER BY data_wpisu DESC;";
  32. $entriesres = mysql_query($entriessql);
  33. $numrows_wpisy = mysql_num_rows($entriesres);
  34.  
  35. echo "<ul>";
  36.  
  37. if($numrows_wpisy == 0) {
  38. echo "<li>Brak wpisów!</li>";
  39. }
  40. else {
  41. while($entriesrow = mysql_fetch_assoc($entriesres)) {
  42. echo "<li>" . date("D jS F Y g.iA", strtotime($entriesrow ['data_wpisu'])) . " - <a href='wyswietlanie_wpisu.php?id=" . $entriesrow['id'] . "'>" . $entriesrow['temat'] ."</a></li>";
  43. }
  44. }
  45.  
  46. echo "</ul>";
  47.  
  48. }
  49. else {
  50. echo "<a href='wyswietlanie_kategorii.php?id=" . $row['id'] . "'>" . $row['kat'] . "</a><br />";
  51. }
  52. }
  53.  
  54.  
  55. require("stopka.php");
  56.  
  57. ?>

wydaje mi sie ze jest wszystko ok i wyswietla sie taki blad

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/sites/yoyo.pl/e/u/euzebia/wyswietlanie_kategorii.php on line 27

Go to the top of the page
+Quote Post
Cysiaczek
post
Post #8





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




Są w ogóle jakieś rekordy w tabeli kategorie?


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post
Diablico14
post
Post #9





Grupa: Zarejestrowani
Postów: 25
Pomógł: 0
Dołączył: 17.08.2008

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


No i tu jest problem sa i to 3 a na stronce nie chca sie wyswietlac nie wiem czemu (plik konfikuracja.php zostal na 100% dobrez skonfikurowany )
Go to the top of the page
+Quote Post
Cysiaczek
post
Post #10





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




Jeżeli to to zapytanie, to zamień:
  1. <?php
  2. $sql = "SELECT * FROM kategorie";
  3.  
  4. $result = mysql_query($sql);
  5. ?>


na
:
  1. <?php
  2. $sql = "SELECT * FROM kategorie";
  3.  
  4. $result = mysql_query($sql) or die(mysql_error());
  5. ?>


i zobacz, co pokazuje.


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post
Diablico14
post
Post #11





Grupa: Zarejestrowani
Postów: 25
Pomógł: 0
Dołączył: 17.08.2008

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


Jest lepiej pisze cos takiego

No database selected
Go to the top of the page
+Quote Post
Cysiaczek
post
Post #12





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




No to w czym problem? Po połączeniu wybierz bazę. Masz wszystko opisane w manualu.

Pozdrawiam.


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post
Diablico14
post
Post #13





Grupa: Zarejestrowani
Postów: 25
Pomógł: 0
Dołączył: 17.08.2008

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


Nie rozumiem ja zrobilem tak ze wyslalem wszystko na yoyo.pl i tam mam baze mysql jak ja wybrac?
Go to the top of the page
+Quote Post
Heweliusz
post
Post #14





Grupa: Zarejestrowani
Postów: 46
Pomógł: 8
Dołączył: 19.03.2007
Skąd: z nad Jarugi

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


mysql_select_db" title="Zobacz w manualu PHP" target="_manual


--------------------
Aktualny projekt: Nauka OOP :)
Go to the top of the page
+Quote Post
Diablico14
post
Post #15





Grupa: Zarejestrowani
Postów: 25
Pomógł: 0
Dołączył: 17.08.2008

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


Juz rozumiem dziekuje za pomoc wszystko dziala poprawnie mozemy zakonczyc temat
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 Aktualny czas: 22.08.2025 - 11:31