Tuesday, 15 May 2012

mysql - PHP Check passed value against count in table -


"itemprop =" text ">

I enter a web form that users want to" quantify "the amount of items that they want to" collect " The game allows to

When they click on the "Submit" button, a PHP file is asked to take action on objects and quantities. The file asks a database table that stores the link that users follow to "collect" the item.

Link table setup link_d | Timestamp is similar to Item_ID | Link

Whatever I would like, it checks the number of available links in the table that is requested by the user and to see if there are sufficient links to request. If not, I want to change the amount requested for the number of available links. I am thinking that what would be the best way to go about it?

Right now I am thinking about something

 for  ($ counter = 0; $ Counter   

Will change with, when I click the user click submit button current number Or available in the table, will be required.

Any idea / suggestion

You can create two values ​​through the MySQL function You can get less ?:

  "select at least (links," .fix items_name [$ counter]). ") As selected_quantity ..." / Code>  

This will , whichever is less, return the number of selected items of that user, or the number of links avaialble.

No comments:

Post a Comment