Re: [PHP] Simplifying MySql queries

2011-02-12 Thread Jim Lucas
On 2/12/2011 12:40 PM, Andre Polykanine wrote: Hi all, I'm using in my PHP script the following four MySql queries: $q1=mysql_query("SELECT *FROM`CandidateQuestions`WHERE `Category`='1' ORDER BY RAND() LIMIT 1"); $q2=mysql_query("SELECT *FROM`CandidateQuestions`WHE

[PHP] Re: Simplifying MySql queries

2011-02-12 Thread Nathan Rixham
Andre Polykanine wrote: and here goes the question: is there a way to make these four in one so strictly one random question is selected from all of the four categories? "SELECT * FROM `CandidateQuestions` WHERE `Category` IN(1,2,3,4) ORDER BY RAND() LIMIT 4" note the limit 4, you'll

Re: [PHP] Simplifying MySql queries

2011-02-12 Thread Simon J Welsh
On 13/02/2011, at 9:40 AM, Andre Polykanine wrote: > Hi all, > I'm using in my PHP script the following four MySql queries: > $q1=mysql_query("SELECT *FROM`CandidateQuestions`WHERE > `Category`='1' ORDER BY RAND() LIMIT 1"); > $q2=mysql_query("SELECT *FROM`CandidateQues

Re: [PHP] Simplifying MySql queries

2011-02-12 Thread Thijs Lensselink
On 02/12/2011 09:40 PM, Andre Polykanine wrote: > Hi all, > I'm using in my PHP script the following four MySql queries: > $q1=mysql_query("SELECT *FROM`CandidateQuestions`WHERE > `Category`='1' ORDER BY RAND() LIMIT 1"); > $q2=mysql_query("SELECT *FROM`CandidateQuestion

[PHP] Simplifying MySql queries

2011-02-12 Thread Andre Polykanine
Hi all, I'm using in my PHP script the following four MySql queries: $q1=mysql_query("SELECT *FROM`CandidateQuestions`WHERE `Category`='1' ORDER BY RAND() LIMIT 1"); $q2=mysql_query("SELECT *FROM`CandidateQuestions`WHERE `Category`='2' ORDER BY RAND() LIMIT 1"); $q3=

[PHP] Re: using BOTH GET and POST in the same page.

2011-02-12 Thread Nathan Rixham
Ashim Kapoor wrote: Dear All, I am reading "PHP5 and MySQL Bible". Chapter 7 of the book says that PHP can use GET and POST in the SAME page! Also it says that we can use the SAME variables in GET and POST variable sets and that conflict resolution is done by variable_order option in php.ini Can

[PHP] Re: using BOTH GET and POST in the same page.

2011-02-12 Thread Nathan Rixham
Ashim Kapoor wrote: Dear All, I am reading "PHP5 and MySQL Bible". Chapter 7 of the book says that PHP can use GET and POST in the SAME page! Also it says that we can use the SAME variables in GET and POST variable sets and that conflict resolution is done by variable_order option in php.ini Can

Re: [PHP] using BOTH GET and POST in the same page.

2011-02-12 Thread Jim Lucas
On 2/11/2011 9:23 PM, Ashim Kapoor wrote: Dear All, I am reading "PHP5 and MySQL Bible". Chapter 7 of the book says that PHP can use GET and POST in the SAME page! Also it says that we can use the SAME variables in GET and POST variable sets and that conflict resolution is done by variable_order