![]() |
![]() |
![]()
Post
#1
|
|
![]() Grupa: Zarejestrowani Postów: 35 Pomógł: 0 Dołączył: 21.01.2009 Ostrzeżenie: (0%) ![]() ![]() |
Witam.
Mam pewien problem. Napisałem skrypt który wybiera newsy z bazy danych i wyświetla je na stronie. Jednak nie działa on tak jak powinien - nigdy nie wyświetla najnowszego newsu. Wyświetla przedostatni i starsze, ale nigdy ten najnowszy który dodałem. Skrypt wygląda 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 "<br> <img src='theme/img/layout/news_cat.gif' align='left' border='0' width='128' height='118'> <font size='4'>".$news_data['news_title']."</font> <br> <img src='theme/img/layout/news_line.gif' border='0'> <br> ".$news_data['news_text']." <br> <p align='right'><font color='#808080' size='2'> Dodano: ".$news_data['news_time'].", ".$news_data['news_date']."<br>Napisał: <a href='showprofile.php?id=".$user_data['user_id']."'>".$news_data['news_author']."</a> </font> <br> <br> <center><br><img src='theme/img/layout/small_sep.gif' border='0'></center>"; } } Gdy dodam tutaj dwa dolary: $news_data = mysql_fetch_array($$news_result); to wyświetla wszystkie newsy, razem z najnowszym. Ale wtedy dodatkowo na górze wywala błąd: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource Wiecie może jak to naprawić? Ten post edytował Buła 23.06.2009, 08:52:41 |
|
|
![]() |
![]()
Post
#2
|
|
![]() Newsman Grupa: Moderatorzy Postów: 4 005 Pomógł: 548 Dołączył: 7.04.2008 Skąd: Trzebinia/Kraków ![]() |
daj sobie mysql_error" title="Zobacz w manualu PHP" target="_manual do mysql_query i będziesz wszystko wiedział.
-------------------- |
|
|
![]()
Post
#3
|
|
![]() Grupa: Zarejestrowani Postów: 35 Pomógł: 0 Dołączył: 21.01.2009 Ostrzeżenie: (0%) ![]() ![]() |
Mógłbyś nieco objaśnić jak to dać?
Bo nie znam się jeszcze dobrze na php ![]() |
|
|
![]()
Post
#4
|
|
![]() Grupa: Zarejestrowani Postów: 286 Pomógł: 34 Dołączył: 4.09.2008 Skąd: Wrocław Ostrzeżenie: (0%) ![]() ![]() |
-------------------- Serwer : Acer Aspire 5050 : AMD Turion X2 2x1.9 MHz : 2x2 GB Dual : 250GB + 500 GB USB Warsztat : Apache v2.2 : PHP v5.2 : MySQL v5.0 : phpMyAdmin v3.4 : phpDesigner v7 |
|
|
![]()
Post
#5
|
|
Grupa: Zarejestrowani Postów: 200 Pomógł: 16 Dołączył: 11.01.2009 Skąd: wrocław Ostrzeżenie: (0%) ![]() ![]() |
spróbuj coś takiego zrobic |
|
|
![]()
Post
#6
|
|
![]() Newsman Grupa: Moderatorzy Postów: 4 005 Pomógł: 548 Dołączył: 7.04.2008 Skąd: Trzebinia/Kraków ![]() |
mogę się coś spytać?
co to jest to, i co ma na celu?
po co pokazujesz liczenie po stronie pasera PHP zamiast po stronie serwera SQL, o wydajności nie słyszał? -------------------- |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 24.07.2025 - 21:17 |