Kdyz si pomoci mysql generuji menu, chci, aby se kazda polozka davala do sve vlastni bunky, coz se mi nedari.
<html>
<head>
<title>http://www.pcaktuality.xf.cz</title>
<link rel="stylesheet" href="mainstyle.css" type="text/css">
</head>
<body>
<?php
$link = mysql_connect("localhost", "root", "root") or die ("Nepovedlo se pripojit");
$db = mysql_select_db("pcaktuality", $link) or die ("Nepovedlo se pripojit k tabulkam");
$query = "select * from menu order by ID";
$result = mysql_query($query, $link) or die ("Chyba databáze. Nepodařilo se vybrat dotaz.");
echo "<table id=\"levy_sloupec\" bgcolor=\"darkorange\">";
while ($row=mysql_fetch_array($result))
echo "<tr><td onmouseover=\"this.style.background='orange'\" onmouseout=\"this.style.background='darkorange'\">".$row["polozka_menu_1"]."</td></tr>";
echo "<tr><td onmouseover=\"this.style.background='orange'\" onmouseout=\"this.style.background='darkorange'\">".$row["polozka_menu_2"]."</td></tr>";
echo "</table>";
mysql_free_result($result);
mysql_close();
?>
</body>
</html>
Vysledekem je jedna velka bunka :(
Fórum › MySQL
Tabulky

Netuším jak se jmenují sloupce, ale pokud tak, jaks je nazval ta by mělo fachat:
<html>
<head>
<title> http://www.pcaktuality.xf.cz
</title>
<link rel="stylesheet" href="mainstyle.css" type="text/css">
</head>
<body>
<?php
$link = mysql_connect('localhost', 'root', 'root') or die ('Nepovedlo se pripojit');
$db = mysql_select_db("pcaktuality", $link) or die ('Nepovedlo se pripojit k tabulkam');
$query = 'select * from menu order by ID';
$result = mysql_query($query, $link) or die ('Chyba databáze. Nepodařilo se vybrat dotaz.');
?>
<table id="levy_sloupec" bgcolor="darkorange">
<?php
while($row = mysql_fetch_array($result)) {
echo ' <tr><td onmouseover="this.style.background=\'orange\'" onmouseout="this.style.background=\'darkorange\'">'.$row['polozka_menu_1'].'</td></tr>'."\n";
echo ' <tr><td onmouseover="this.style.background=\'orange\'" onmouseout="this.style.background=\'darkorange\'">'.$row['polozka_menu_2'].'</td></tr>'."\n";
}
?>
</table>
<?php
mysql_free_result($result);
?>
</body>
</html>
Věřím, že můžete v životě získat všechno, co budete chtít, když budete pomáhat druhým lidem, aby dostali to, co si přejí oni. - Zig Ziglar

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, 7 hostů
Podobná vlákna
Jak přenést změny ve struktuře vzorové tabulky na další tabulky — založil Marty
Překopírování tabulky do druhé tabulky s doplněním hodnot — založil marpit
Tabulky — založil lolik
Editování tabulky — založil Pavel
2 různé tabulky — založil Tom
Moderátoři diskuze