Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
stack
Nov 28, 2000
Is there a way to catch 'Ctrl-C' in a PHP CLI script running in Windows? PCNTL isn't available for Windows so I can't easily use it to catch the signal for it. Google only turns up one post on php.net where a guy made a custom build of PHP to include PCTNL and that won't work for my situation.

Adbot
ADBOT LOVES YOU

stack
Nov 28, 2000

Safety Shaun posted:

Thanks for the pointers sirs, now I have another annoyance.

The more questions they answer, the more likely it is that a question they've already answered will come up. If I store which q_ids they do in a string inside a cookie or session, is it possible with a simple query to do a

SELECT * FROM questions WHERE q_id != $IN_THIS_ARRAY() ORDER BY rand( ) LIMIT 1

Or something similar?

code:
SELECT * FROM questions WHERE q_id NOT IN (x, y, z) ORDER BY RAND() LIMIT 1;
Use implode() to turn your array into a comma separated list which I represented above with 'x, y, z'.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply