开发者

A form with one field that counts the times a value has been entered

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.

Thanks.


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)

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

  1. get the value
  2. query the table for the value
  3. if found, update wordcount = wordcount + 1
  4. else insert the word and a count of 1.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜