Currently I'm busy with a simple CKeditor notepad for webapplication. I already have code to save the user text into the database.
Now I want to add code that will retrieve the latest saved (latest id) text from the database, so the user can continue his/her work.
<?php
if(isset($_POST['editor1'])) {
$text = $_POST['editor1'];
$conn = mysqli_connect("$dbhost", "$dbuser", "$dbpass", "$db") or die("ERROR");
$query = mysqli_query($conn, "INSERT INTO content (content) VALUES ('$text')");
if($query)
echo "Succes!";
else
echo "Failed!";
}
?>
this is the code to save the users text.
Now I want to build code that will retrieve the latest saved text from the database, but I can't make a start with my code.
<textarea name="editor1" id="editor1" rows="10" cols="80">
<?php
$conn = mysqli_connect("$dbhost", "$dbuser", "$dbpass", "$db") or die("ERROR");
$sql = "SELECT content from content";
?>
</textarea>
This is what I currently have.