English 中文(简体)
政变法典统计
原标题:coupon code statistics

我有一个允许用户进入政变的系统(例如麦地或阿马逊)。

我想知道,政变在500次政变不再有效之后,发生了多少起政变。

我现在想到的是,将政变插入一张桌子,然后插入slect=1(*)/code>,如果它达到50岁,我就不插入,我回来说它已经过期。

我认为,这一解决办法是行之有效的,但是,如果能找到更好的办法,我想加以验证和检查。

最佳回答

我假定,某些表格中储存了有密码、描述等的政变,在政变使用时,加上“南”一词。 如果需要,你仍可以把政变插入命令,但你不需要这样做。 你只是检查一下你在装上政变时已经使用了多少次。 我假定,你通过政变法来核查是否有效,这样就会使另一个时候消失。

问题回答

你们可以“向”政变法。

Example (for you mysql orders table): order ABC use coupon "Coupon1" order BCD use coupon "Coupon1"

那么,你可以发挥这样的职能:

function getCouponUsage($a_couponCode){
  $res = mysql_query("SELECT couponCode FROM orders WHERE coupon =  $a_couponCode ") or die(mysql_error());
  return mysql_num_rows($res);
}

This function will return an integer. Just compare with your limit.

你们也可以打上打击。 请允许我说,政变可以被500次使用,当有人利用政变,你去除政变,总数将达到499次(政变从现在起就可使用499次)。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...