\n"; while ($row = mysql_fetch_assoc ($result)) { $nimi=$row['nimi']; $hind=$row['hind']; $p2ev=$row['p2ev']; echo "$nimi$hind$p2ev Kustuta Muuda"; } echo "\n"; if ($all == 0) { echo "Vaata kõiki sööke korraga\n"; } echo "

Vaata täiega päevakaupa!"; $query2 = "SELECT id, p2ev FROM p2evad ORDER BY id"; $result2 = mysql_query ($query2); echo "

\n"; while ($row = mysql_fetch_assoc ($result2)) { echo ""; } echo "
$row[p2ev]
"; echo "


"; echo "
\n"; echo "
Nimi:
\n"; echo "
Hind:
\n"; echo "
Päeva number (E=1, T=2 jne):
"; echo "
\n"; } function p2evad($id) { global $db; $query = "SELECT id, nimi, hind, p2evID FROM s66gid WHERE p2evID=$_REQUEST[id]"; $result = mysql_query ($query); echo "\n"; while ($row = mysql_fetch_array ($result)) { $nimi=$row['nimi']; $hind=$row['hind']; echo ""; } echo "
$nimi$hind
\n"; echo "
Avalehele\n"; } function lisa() { global $db; $query = "INSERT INTO s66gid (nimi, hind, p2evID) VALUES ('{$_POST['nimi']}', '{$_POST['hind']}', '{$_POST['p2evID']}')"; mysql_query ($query); echo mysql_error(); echo "jee?!"; echo "
Avalehele\n"; } function kustuta($id) { global $db; $query = "DELETE FROM s66gid WHERE id=$id"; mysql_query ($query); echo mysql_error(); echo "jee?!"; echo "
Avalehele\n"; } function muuda($id) { global $db; $query = "SELECT id, nimi, hind, p2evID FROM s66gid WHERE id=$_REQUEST[id]"; $result = mysql_query ($query); $row = mysql_fetch_array ($result); mysql_error(); echo "\n"; echo ""; echo ""; echo ""; echo "
"; echo "
Avalehele\n"; } function muuda2($id) { global $db; $query2 = "UPDATE s66gid SET nimi='{$_POST['nimi']}', hind='{$_POST['hind']}', p2evID='{$_POST['p2evID']}' WHERE id=$_REQUEST[id]"; mysql_query ($query2); echo "
Tagasi muutma\n"; echo "
Avalehele\n"; } switch($_GET['action']) { case 'p2evad': p2evad($id); break; case 'muuda': muuda($id); break; case 'muuda2': muuda2($id); break; case 'lisa': lisa(); break; case 'kustuta': kustuta($_GET['id']); break; case 'all': avaleht(1); break; default: avaleht(); } ?>