Pieszę mi błąd:
Wystąpił błąd
["select * from newsy where id = order by id DESC;"]
[You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by id DESC' at line 1]
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Wystąpił błąd
["UPDATE newsy SET czytano=czytano + 1 WHERE id = "]
[You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
--------------------------------------------------------------------------------
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/virtual/gry.zombie.nekromanta.pl/htdocs/page/wiadomosci.php on line 11
Brak wiadomości w bazie danych
Myślę że kod jest dobry i dlaczego mi wywala błąd!?

?

?!
Mam taki kodzik:
<?php
////////////////////////////////////////////////////////////////
// powered by: //
// AK DESIGN TECHNOLOGY //
// 2005 //
/////////////////////////////////////////////////////////////////
// Je¶li link wygl±da tak: wiadomosci.php?akcja=czytaj&id=2 to uzytkownik zostanie przeniesiony na strone na ktorej pokazuje się ca
la tresc newsa
if ($_GET['akcja'] == 'czytaj'){
$result_newsy = sql("select * from newsy where id = $id order by id DESC;");
$result_czytano = sql("UPDATE newsy SET czytano=czytano + 1 WHERE id = $id");
print("Brak wiadomo¶ci w bazie danych");//je¶li nie ma newsów pokazuje się odpowiedni komunikat... }
else {
print("<table width="95%" align="center
" border="0" cellspacing="0" cellpadding="0"> <tr>
<td bgcolor="#555555" valign="top" align="left"><strong>$row_newsy[1]</strong> :: $row_newsy[5]</td>
<tr>
<td valign="top">Dodał: $row_newsy[4]</td>
</tr>
<tr>
<td valign="top" colspan="3"<img src="grafika/separ.gif" witdh"1" height="15"></td>
</tr>
<tr>
<td valign="top" colspan="3">$row_newsy[2]</td>
</tr>
<tr>
<td valign="top" colspan="3"<img src="grafika/separ.gif" witdh"1" height="15"></td>
</tr>
<tr>
<td valign="top" colspan="3">$row_newsy[3]</td>
</tr>
<tr>
<td valign="top" colspan="3"<img src="grafika/separ.gif" witdh"1" height="15"></td>
</tr>
</table><br>");
}
}//nie robi się nic
}
?>
<?
if ($_GET['akcja'] == ''){// jeżeli nie było przekazanej akcji w linku(zmiennej)to wy¶wietlaja się wszystkie newsy...
$result_newsy = sql("select * from newsy order by id DESC;");
print("Brak wiadomo¶ci w bazie danych");//je¶li nie ma newsów pokazuje się odpowiedni komunikat... }
else {
print("<table width="95%" align="center
" border="0" cellspacing="0" cellpadding="0"> <tr>
<td valign="top" bgcolor="#555555" align="left"><strong><a href="index.php?dzial=wiadomosci&akcja=czytaj&id=$row_newsy[0]">$row_newsy[1] </a></strong>:: $row_newsy[5]</td>
<tr>
<td valign="top">Dodał: $row_newsy[4]</td>
</tr>
<tr>
<td valign="top" colspan="3"<img src="grafika/separ.gif" witdh"1" height="15"></td>
</tr>
<tr>
<td valign="top" colspan="3">$row_newsy[2]</td>
</tr>
<tr>
<td valign="top" colspan="3"<img src="grafika/separ.gif" witdh"1" height="15"></td>
</tr>
<tr>
<td valign="top"><a href="index.php?dzial=wiadomosci&akcja=czytaj&id=$row_newsy[0]">Czytaj dalej -->></a> </td>
</tr>
</table><br>");
}
}//nie robi się nic
}
print("<center><a href="index.php?dzial=archiwum&co=wiadomosci">Pokaż wszystkie</a>");//je¶li nie ma newsów pokazuje się odpowiedni komunikat...
?><br/><br/>
<?
$result_ile = sql("select count(*) from newsy;");// ile newsów w bazie danych...
print("Brak wiadomo¶ci w bazie danych");//je¶li nie ma newsów pokazuje się odpowiedni komunikat... }
else {
print("<center><strong><small>Wszystkich wiadomo¶ci w bazie danych: $row_ile[0]</center></strong></small>"); }
}//nie robi się nic
?>
Ten post edytował vieri_pl 20.08.2005, 12:18:24