\n"; while ($row = mysql_fetch_assoc ($result)) { echo "$row[looom] Kustuta Muuda
"; } echo "\n"; if ($k6ik == 0) { echo "Vaata kõiki loomi korraga\n"; } echo "


"; echo "
\n"; echo "Loom: \n"; echo "\n"; } function lisa() { global $db; $query = "INSERT INTO looomad (looom) VALUES ('{$_POST['looom']}')"; mysql_query ($query); echo mysql_error(); echo "jee?!"; echo "
Avalehele\n"; } function kustuta($id) { global $db; $query = "DELETE FROM looomad WHERE id=$id"; mysql_query ($query); echo mysql_error(); echo "jee?!"; echo "
Avalehele\n"; } function muuda($id) { global $db; $query = "SELECT id, looom FROM looomad 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 looomad SET looom='{$_POST['looom']}' WHERE id=$_REQUEST[id]"; mysql_query ($query2); echo "
Avalehele\n"; } switch($_GET['action']) { case 'muuda': muuda($id); break; case 'muuda2': muuda2($id); break; case 'lisa': lisa(); break; case 'kustuta': kustuta($_GET['id']); break; case 'k6ik': avaleht(1); break; default: avaleht(); } ?>