Good day. I don’t know much about php, so the question is: I have this code, but it saves the data in a .json file. And I need to remake it so that it sends the data to the Mysql table on the server. (I already created a bd-shku, I created a table in it with 2 columns: id and text directly).
What should be the result: There is one textarea field that constantly contains the entered text. (That is, when you reload the page, or enter from another computer - we should see the last text entered). A kind of note of its kind.
<?php $note_name = 'note.json'; if(isset($_SERVER['HTTP_X_REQUESTED_WITH'])){ // Запрос AJAX if(isset($_POST['note'])){ file_put_contents($note_name, $_POST['note']); echo '{"saved":1}'; } exit; echo '{"saved":0}'; } $note_content = ''; if( file_exists($note_name) ){ $note_content = htmlspecialchars( file_get_contents($note_name) ); } ?> I would be grateful for the help!