Php generate coupon or vouchers

function generate_promotion_code($no_of_codes=10, $exclude_codes_array="bb,hh", $code_length=4)

$characters = "0123456789 abcdefghijklmnopqrstuvwxyz";
$promotion_codes = array (); //this array is used to receive promo code generated

for ($j=0; $j <$no_of_codes; $j++)
for ($i=0; $i <$code_length; $i++)

$code.=$characters [mt_rand (0, strlen ($characters) - 1)];

}//if the generated four random number is no longer we defined $promotion_codes function inside the

if (! In_array ($code, $promotion_codes))
if (is_array ($exclude_codes_array))//
if (! In_array ($code, $exclude_codes_array))//has ruled out using the coupon code in the
$promotion_codes [$j]=$code; //Will generate new promo code assigned to promotion_codes array

} else
$j --;

$promotion_codes [$j]=$code;//the promo code assigned to the array

$j --;


return $promotion_codes;

echo ' Promotion/Discount Codes echo ';
print_r (generate_pro…

Group by reversible pair

You can use a UNION of two subqueries:
SELECT user_id, MAX(ts)AS last_timestamp, SUM(cnt)AS number_of_messages FROM(SELECT to_user_id AS user_id, MAX(timestamp)AS ts, COUNT(*)AS cnt FROM chat WHERE from_user_id =1GROUPBY to_user_id UNIONALLSELECT from_user_id AS user_id, MAX(timestamp)AS ts, COUNT(*)AS cnt FROM chat WHERE to_user_id =1GROUPBY from_user_id )AS tmp GROUPBY user_id ; Two indexes, on (from_user_id, to_user_id, timestamp) and (to_user_id, from_user_id, timestamp) would help efficiency of the subqueries.

Get same hash code

// Get same hash code
$user1 = 1;
$user2 = 2;

$hash1 = sha1(max($user1,$user2));
$hash2 = sha1(max($user2,$user1));

echo $hash1.'

echo $hash2.'



How to write quiz for

<br /> <br /> <?xml version="1.0" encoding="UTF-8"?><br /> <items> <br /> <item><br /> <question>first</question><br /> <option1></option1><br /> <option2></option2><br /> <option3></option3><br /> <option4></option4><br /> <option5></option5><br /> <option6></option6><br /> <answer></answer><br /> <description></description> <br /> </item> <br /> <item><br /> <question>second</question><br /> <option1></option1><br /> <option2></option2><br /> <option3></option3><br /> <option4></option4><br /> <option5></option5><br /> <option6></option6><br /> <answer></answer><br /> <description>&l…

Easiest way to Convert website to android application

Convert Website to Android application – Here I share with you how to convert website to android application using android studio. Now a days most of peoples have android mobiles and they all like to use the application rather then desktop. So i have publish this article make simple way to access your website throw android application.
Most of them still struggle to make an android application even college students also but here simply make android application within 15 minutes. Non-educated peoples also easily make the android app using android studio.
Convert website to android application Okay fine, Now we have start the work to make an android application.
Follow the procedure 1. First you have open Android Studio, suppose if you not have android studio just install now from android official site Android Studio.
2. Then create new project in android studio & click Next (like below image)

3. Then click Next no changes (like below image)

4. Hereafter, choose the Empty Ac…

Which Coin or Alt coin or Cryptocurrencies Have the Fastest Transaction or transfer Speeds?

The stock market may be the most traditional path investors have used to create wealth over time, but in recent months, it's taken a clear back seat to cryptocurrencies. Since 2017 began, the combined value of all cryptocurrencies jumped from less than $18 billion to as high as $836 billion just a week ago. We're talking about an increase in value of more than 4,500% in about a 53-week span. It has, by comparison, taken the broad-based S&P 500 decades to deliver similar returns.
The emergence of blockchain pushes crypto valuations into the stratosphere Though there are no shortage of catalysts behind this rally in digital currencies, much of the credit belongs to the emergence of blockchain technology. Blockchain is the digital and decentralized ledger that underpins virtual coins and is responsible for logging all transactions, without the need for a financial intermediary, like a bank.
Image source: Getty Images. The push toward blockchain technology, and cryptoc…

Create columns in mysql database

ALTERTABLE`fr_yearbook`ADD`best_friend`VARCHAR(500) NOTNULLAFTER`address`, ADD`best_lecturer`VARCHAR(500) NOTNULLAFTER`best_friend`;

Connecting students around the world

“Lets’ Build the largest free online school in our image and likeness”.

School as a whole is nice, although it requires one’s productive time, energy & comfort.

But what happens when you are helpless and need the right contact(s)?
What happens when you need to share or get accurate information or resources but lack the right source?

Then imagine you could share and get whatever information & academic materials you need, without stress & at your convenience, by simply using your phone or laptop or pc.

Imagine you could share or get access to the materials you would need from your first year to final year at any point in time even as a jambite, jupeb, part time or as a regular student.

At 4scholars you can upload & retrieve materials at your convenience.

At 4scholars you would be opportuned to meet & interact with students of other institutions.

4scholars is not just a social network, it is an educational revolution.

Lets stop the epidemic of scarce & expensive materials…