In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of "how to achieve the rating function of jQuery+Ajax+PHP". The editor shows you the operation process through an actual case, and the operation method is simple, fast and practical. I hope this article "how to achieve the rating function of jQuery+Ajax+PHP" can help you solve the problem.
Realization process
When the user clicks the Hearts button on his favorite picture on the page, the front page sends an ajax request to the background. After receiving the request, the background PHP program queries whether there is a click record of the user in the IP library. If not, the corresponding value is + 1. At the same time, the user's IP information is written to the IP library, otherwise, the user is told that he has "liked it".
Database design
First, prepare two tables. The pic table stores the picture information, including the corresponding name, path and the total number of "likes" of the picture. Pic_ip records the IP data after the user clicks on it.
CREATE TABLE IF NOT EXISTS `pic` (`id` int (11) NOT NULL AUTO_INCREMENT, `pic_ name` varchar (60) NOT NULL, `pic_ url` varchar (60) NOT NULL, `love` int (11) NOT NULL DEFAULT '0mm, PRIMARY KEY (`id`) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `pic_ ip` (`id`int (11) NOT NULL AUTO_INCREMENT, `pic_ id` int (11) NOT NULL, `ip`varchar (40) NOT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8
Index.php
In index.php, we read the picture information in the pic table through PHP and display it, combined with CSS to improve the display effect of the page.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.