prepare("SELECT id, tekst FROM test"); $kask->bind_result($id, $tekst); //echo (string)$kask; $kask->execute(); while($kask->fetch()){ $out[] = array( "id" => $id, "tekst" => $tekst ); } $kask->close(); $yhendus->close(); echo json_encode($out); } if(isSet($_REQUEST["tekst"])){ $yhendus = new mysqli("localhost", "ifi6093", "kasutajaliidesed", "ifi6093_kris88"); $kask = $yhendus->prepare("INSERT INTO test (tekst) VALUES (?)"); $kask->bind_param("s", $_REQUEST["tekst"]); $kask->execute(); $kask->close(); $yhendus->close(); }