This article mainly shares with you a detailed example of the message board function implemented by Ajax and MySQL data interaction. Recently, I made a small demo to realize the data interaction between Ajax and MySQL. The js part uses jq, and the background uses PHP. The database is mysql, and a node+MongoDB version will be available later.
I won’t go into details about the use and installation of mysql. Baidu xampp, Apache server and mysql database are integrated by myself, which is very easy to use.
First open the server and database. I established them here first. An "eleven" database, with a table called microblog created below (please note: I am using a higher version of mysql here, and the PHP database linking methods use mysqli_. If the version is too low, please use the mysql_ method. Modify the code yourself)
The following is the code part:
html page and js part: