本文介绍了每当我的数据库中的页面加载到浏览器中时,mysql数据类型或php代码就增加1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Dreamweaver构建Lyrics数据库网站。
我有一个歌词表,并且有一个名为 views的列,每当在浏览器中查看特定的歌词时,我想将其增加1。



如何使用mysql完成此操作?
我可以使用什么mysql数据类型或PHP?



请彻底解释,因为我不太了解php或mysql,我只是在尝试。 p>

记住我正在使用Dreamweaver。



谢谢。

解决方案

说实话,我们需要了解您的PHP和MySQL的布局。您是要有人为您写书还是要学习?



查询内容如下:

  $ query = UPDATE`myviewstable` SET count = count + 1 WHERE id ='$ id'; 

我相信这会起作用。 id 是您的歌词ID, count 是您用于跟踪数字的列。


I am trying to use Dreamweaver to build a Lyrics database website.I have a table for the lyrics and I have a column called "views" that I want to increase by 1 every time that particular lyric is viewed in a browser.

How can I accomplish this using mysql?What mysql datatype Or PHP can I use?

Please explain thoroughly because I do not know php or mysql that well, I'm just trying.

Remember I am using Dreamweaver.

Thanks.

解决方案

Well we would need to see how your PHP and MySQL is laid out to be honest. Do you want someone to just write it for you or do you want to learn?

The query would be something like this:

$query = "UPDATE `myviewstable` SET count = count+1 WHERE id = '$id'";

I believe that would work. id is your lyric id and count is your column for keeping track of numbers.

这篇关于每当我的数据库中的页面加载到浏览器中时,mysql数据类型或php代码就增加1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 11:47