Jsem úplný začátečník v PHP a chtel by jsem se zeptat, proč sa mi nevypisují data z db pri takomto kóde:
<?php
$connect=mysql_connect("mysql.webzdarma.cz", "nuggettgoldfa", "********") or die ("Chyba v pripojení K serveru SQL na riadku číslo :<STRONG>".__LINE__."</STRONG>");
$db=@mysql_select_db("nuggettgoldfa",$connect) or die ("Chyba v pripojení K databázy na riadku číslo :<STRONG>".__LINE__."</STRONG>");
$query = "SELECT * FROM novinky ORDER BY datum";
$result = mysql_query($query, $connect) or die ("Chyba na riadku číslo :<STRONG>".__LINE__."</STRONG>");
$rows = mysql_num_rows($result);
if($rows=="0") {echo "V databáze sa nenachádzajú žiadne informácie";exit;}
echo "<TABLE border=\"1\" align=\"center\">\n";
echo "<TBODY><TR>\n";
echo "<TD><STRONG>Dátum</STRONG></TD>\n";
echo "<TD><STRONG>Novinka</STRONG></TD>\n";
echo "</TR>\n";
$vysledok=@MySQL_Num_Rows($mysql_query);
for($i=0;$i<$vysledok;$i++)
{
$datum = MySQL_Result($mysql_query, $i, "datum");
$text = MySQL_Result($mysql_query, $i, "text");
echo "\n";
echo "".$datum."\n";
echo "".$text."\n";
echo "\n";
}
echo "</TABLE>\n" ;
@mysql_close($connect);
?>
Dik za odpovede :smile1: :smile1: :smile1:
Fórum › PHP
Vypsání údajov z db (MySQL)

Ten kod mi prijde celkove nejaky "ztresteny". Pouzivas napr. toto
$vysledok=@MySQL_Num_Rows($mysql_query);
a nikde nevidim definici promenne $mysql_query
. Pokud chces, aby ten kod fungoval, muzu ho prepsat do srozumitelnejsiho tvaru, protoze to tvoje vypada jako nejaky copy&paste nekolika reseni dohromady.
Přidej příspěvek
Toto téma je starší jak čtvrt roku – přidej svůj příspěvek jen tehdy, máš-li k tématu opravdu co říct!
Ano, opravdu chci reagovat → zobrazí formulář pro přidání příspěvku
×Vložení zdrojáku
×Vložení obrázku
×Vložení videa
Aktuálně jsou podporována videa ze serverů YouTube, Vimeo a Dailymotion.
×






























































Uživatelé prohlížející si toto vlákno
Uživatelé on-line: 0 registrovaných, 34 hostů
Podobná vlákna
Tabulka mysql viac udajov — založil Martin
Vypsání z mysql — založil KOzIčÁk
Výběr řádků k vypsání z MySQL — založil XYZ
Kontrola údajov — založil Michal115
Triedenie udajov v C — založil presto
Moderátoři diskuze