具有一个字段的表单,该字段对输入值的次数进行计数 [英] A form with one field that counts the times a value has been entered

查看:75
本文介绍了具有一个字段的表单,该字段对输入值的次数进行计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个带有一个字段的简单表单,该字段将输入保存在SQL数据库中.然后,我想按提交次数按顺序列出已提交的内容.我不怎么做表格来做到这一点.

I need a simple form with one field that saves the input on my SQL database. Then I want to be get a list of the things that have been submitted ordered by the number of times they have been submitted. I don't how to make the form do this.

我不确定是否很清楚,如果不清楚,请发表评论.

I'm not sure if it's clear, If not please leave a comment.

谢谢.

推荐答案

这不是一个简单答案的简单问题.看来,您需要学习几件事才能完成您的要求.用Google搜索PHP SQL教程将提供一长串提供建议的网站. 喜欢这个.

This is not a simple question with a simple answer. It seems that there are several things that you need to learn in order to accomplish what you ask. A google search for PHP SQL tutorials will bring up a long list of websites that offer suggestions. Like this one.

我建议您先从这样的教程开始,然后逐步进行.遇到问题时,您可以在此处询问具体问题.

I would suggest that you start with a tutorial like that and take it step at a time. When you run into problems you can ask here about the specific problem.

将输入到表单中的值保存到数据库中并不难.您的逻辑将必须考虑到该值可能已经存在.您将需要一个这样的表:

Saving the values entered into the form in a database is not difficult. Your logic will have to take into consideration that the value may already exist. You will need a table like this:

   terms = (word, wordcount)

其中wordcount是输入单词的次数.用户输入值时,您将:

where wordcount is the number of times the word was entered. When a user enters a value you will:

  1. 获取价值
  2. 查询表中的值
  3. 如果找到,请更新wordcount = wordcount + 1
  4. 否则插入单词并计数为1.

这篇关于具有一个字段的表单,该字段对输入值的次数进行计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆