phppaper Posted November 24, 2010 Share Posted November 24, 2010 Hello, How can you write a query for php to run with "3" and condition e.g. $temp = "select * from xxxx where condition1 and condition2 and condition3"; can I use 3 "and"?? Quote Link to comment https://forums.phpfreaks.com/topic/219648-php-mysql-with-3-and-condition/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 24, 2010 Share Posted November 24, 2010 You can make a WHERE clause with any number of conditions in it, as long as it makes logical sense and does not exceed the maximum length of a query statement (default is 2M bytes if I remember correctly.) If you have a query that you need help with, you would need to post it. Quote Link to comment https://forums.phpfreaks.com/topic/219648-php-mysql-with-3-and-condition/#findComment-1138815 Share on other sites More sharing options...
phppaper Posted November 24, 2010 Author Share Posted November 24, 2010 Hey thanks but this does not work: $temp = "select * from table where DATE(start) <= CURDATE() and DATE(end) >= CURDATE() and type = 'A'"; it does not work after I put and type = 'A' start, end , type are 3 fields, please help Quote Link to comment https://forums.phpfreaks.com/topic/219648-php-mysql-with-3-and-condition/#findComment-1138816 Share on other sites More sharing options...
PFMaBiSmAd Posted November 24, 2010 Share Posted November 24, 2010 Is the query producing a mysql error or does it simply return zero rows? What is the data type of the type column? Have you attempted to execute the query directly against your database using your favorite database management tool (phpmyadmin or similar)? Have you confirmed that you have a matching row(s) in your table? Quote Link to comment https://forums.phpfreaks.com/topic/219648-php-mysql-with-3-and-condition/#findComment-1138820 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.