Search found 54 matches

by tonchily
Sun May 01, 2011 5:01 am
Forum: PHP - Code
Topic: Selling with Paypal
Replies: 4
Views: 770

Re: Selling with Paypal

Well, the initial part should be a piece of cake (generating the numbers and storing them). NetTuts have a nice tutorial on using PayPal's IPN here . Yeah, but I don't know how to do it. I mean, I can create php file that will generate numbers and store them in DB with column payed=0 but how can I ...
by tonchily
Sat Apr 30, 2011 6:12 am
Forum: PHP - Code
Topic: Selling with Paypal
Replies: 4
Views: 770

Selling with Paypal

Okay so I have these 5 products that users get to choose from select box and click on Pay now button (all code generated via Paypal) These products are actually (kind of) lottery tickets, and I want to do the following: when the users choose for example 2 lottery tickets, generate the random two num...
by tonchily
Sat Apr 23, 2011 9:17 am
Forum: PHP - Code
Topic: PHP Countdown
Replies: 6
Views: 577

Re: PHP Countdown

Celauran wrote:Any reason you're not just running this from cron?
Because I can't predict the time countdown will start and that way I don't know when will it end. Start of the countdown is dynamical also.
by tonchily
Fri Apr 22, 2011 12:48 pm
Forum: PHP - Code
Topic: PHP Countdown
Replies: 6
Views: 577

Re: PHP Countdown

yes, and that visitor view the webpage you want to show after the countdown reached 00:00:00 ... what do u want to do ?? Once the countdown has reached 00:00:00, I want to run file "update.php" which generates number between 1 and 100 and then use that $generated_number in query like &quo...
by tonchily
Fri Apr 22, 2011 11:07 am
Forum: PHP - Code
Topic: PHP Countdown
Replies: 6
Views: 577

Re: PHP Countdown

fugix wrote:you could store the countdown timestamp into a variable and then set an if function for when that variable is = to 00:00:00
Yeah but that means the script would run when someone visits that page. What if there's noone online?
by tonchily
Fri Apr 22, 2011 10:29 am
Forum: PHP - Code
Topic: PHP Countdown
Replies: 6
Views: 577

PHP Countdown

Hello guys, I have a countdown that is counting from 24:00:00 to obviously 00:00:00. I need it to run a specific php file once it gets to zero. Anyone knows how may I accomplish this? I suppose it's pretty easy but I don't have an idea right now. About the countdown start time - it's been stored in ...
by tonchily
Sat Jan 08, 2011 9:50 am
Forum: PHP - Code
Topic: Creating divs with loop but different classes
Replies: 2
Views: 90

Creating divs with loop but different classes

For example I got a mysql table with columns ID (which is autoincerement) and name. I got 5 entries with values "John", "Mike", "Brian", "Tony", "Luke". I want to make a loop create divs with different classes and repeat it all the time when new entr...
by tonchily
Sun Dec 19, 2010 9:08 am
Forum: PHP - Code
Topic: Showing errors at registration
Replies: 1
Views: 37

Showing errors at registration

Hi. I've created the html form and a way to process data to mysql database, but what I want to do is handle errors. For example if user tried to register with invalid email format and username containing invalid characters, I want both to be shown once he tries to register. All I managed to do now i...
by tonchily
Sun Dec 19, 2010 6:21 am
Forum: PHP - Code
Topic: Creating multilingual website
Replies: 4
Views: 141

Re: Creating multilingual website

Lets say I want to use it via language files (so it would be lang_english.php, lang_german.php, lang_spanish.php) which have the same strings (which are stored into variables) and just translate the text of these variables - how would I import it into lets say index.php? Using include function and t...
by tonchily
Sun Dec 19, 2010 5:49 am
Forum: PHP - Code
Topic: Creating multilingual website
Replies: 4
Views: 141

Creating multilingual website

What would be the best way to create a multilingual website? Saving strings in mysql and make every language has its own table? I really don't have an idea on how to do this so any help is appreciated.
by tonchily
Thu Dec 09, 2010 4:34 pm
Forum: PHP - Code
Topic: Football match engine in PHP
Replies: 0
Views: 432

Football match engine in PHP

I've started a project to start a text-based football manager game. I have done a lot of coding (mainly the visual stuff) and now it's time to do something about the probably the most important thing there is when talking about football - the results. I really don't have any idea on how to create a ...
by tonchily
Thu Oct 07, 2010 5:15 am
Forum: PHP - Code
Topic: Round number to closest half
Replies: 7
Views: 495

Re: Round number to closest half

VladSun wrote:
VladSun wrote:

Code: Select all

echo number_format(round5(1.62), 2);
Thanks a lot once again VladSun.
by tonchily
Thu Oct 07, 2010 5:03 am
Forum: PHP - Code
Topic: Round number to closest half
Replies: 7
Views: 495

Re: Round number to closest half

function round5($v) { return round($v*2, 1)/2; } assert('round5(1.56) === 1.55'); assert('round5(1.574) === 1.55'); assert('round5(1.575) === 1.6'); assert('round5(1.62) === 1.6'); assert('round5(1.63) === 1.65'); echo number_format(round5(1.62), 2); This works great! Thanks a lot! Just one simple ...
by tonchily
Sun Oct 03, 2010 3:11 pm
Forum: PHP - Code
Topic: Round number to closest half
Replies: 7
Views: 495

Round number to closest half

I'll show an example of I need to be done and I'm sure you'll get what I mean: $number1 = 1.56 // that number needs to be rounded to 1.55 $number2 = 1.574 // that number needs to be rounded to 1.55 aswell $number3 = 1.575 // that number needs to be rounded to 1.60 $number4 = 1.62 // rounded to 1.60 ...
by tonchily
Thu Sep 30, 2010 2:17 pm
Forum: PHP - Code
Topic: Comparing two timestamps
Replies: 8
Views: 171

Re: Comparing two timestamps

pytrin wrote:Did you visit the link I gave you? it's a mysql function, not PHP
in PHP you can use strtotime(), but bear in mind that you might lose timezone information (might not be relevant for you)

I did. I still fail to get this to work. I don't know where to put the UNIX_TIMESTAMP(); command.