Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Błąd z mysql_fetch_array()
Buła
post 9.05.2009, 19:14:29
Post #1





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 21.01.2009

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


Witam.

Mam problem ze skryptem wybierania i wyświetlania newsów z bazy danych.

Wygląda on tak:
Kod
    $news_result = mysql_query("SELECT * FROM gbsite_news ORDER BY news_id DESC");
     $news_data = mysql_fetch_array($news_result);
     if (mysql_num_rows($news_result) != 0)
     {
         while ($news_data = mysql_fetch_array($news_result))
         {

             $user = $news_data['news_author'];
             $user_result = mysql_query("SELECT `user_id` FROM gbsite_users WHERE user_name = '$user'");
             $user_data = mysql_fetch_array($user_result);

             echo "

             <img src='theme/img/layout/news_cat.gif' align='left' border='0' width='128' height='118'>
             <font size='4'>".$news_data['news_title']."</font>

             <img src='theme/img/layout/news_line.gif' border='0'>

             ".$news_data['news_text']."
  
             <p align='right'><font color='#808080' size='2'> Dodano: ".$news_data['news_time'].", ".$news_data['news_date']."
Napisał: <a href='showprofile.php?id=".$user_data['user_id']."'>".$news_data['news_author']."</a> </font>
  

             <center>
<img src='theme/img/layout/small_sep.gif' border='0'></center>";
         }
     }


I w przeglądarce generuje taki błąd:

Kod
<b>Warning</b>:  mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>D:\Programy\WebServ\httpd\news.php</b> on line <b>13</b>


Linia 13 to:
Kod
    $news_data = mysql_fetch_array($news_result);


Wiecie może co jest nie tak?
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 Wersja Lo-Fi Aktualny czas: 23.06.2025 - 19:33