All I’m trying to do is a query for my table that contains 6 columns with a condition that has to be met by 3 of those columns
my table’s information
table name My_table columns a1, a2, a3, a4, a5, a6
the code I have tried is below, doesn’t work of course
$myquery = "SELECT * FROM My_table WHERE a2='$variable1' AND a3='$variable2' AND a6='$variable3' ORDER BY a2 ASC";
$myresult = mysql_query($myquery);
my result has to contain the rows that met the conditions above.
What is the right way to do this?
Thanks in advance.
Ok this is how I made it work, it works great for me so it could help you too.
Since I’m comparing 3 columns of my table with 3 variables and I know that they are fix and has to meet those conditions exactly and in that order, I made a string of the 3 columns I’m searching in UPPER case then did the same with my variables then compare the against each other, that gave me the result I was looking for.
here is the solution code to my problem:
$myresult = mysql_query($myquery);
Hopes it helps someone else too.