A general single sql query

soniabd78

New Member
I have a table like this:\[code\]id | roll_no | name--------------------- 1 | 111 | Naveed 2 | 222 | Adil 3 | 333 | Ali \[/code\]If I have data like this:\[code\]$fields = array( "id" , "roll_no" )\[/code\] and \[code\]$values = array( "1,111", "2,222" );\[/code\]It means I have to write a sql query to get records from table where (id != 1 and roll_no != 111) and (id != 2 and roll_no != 222). It means 3rd record will be fetched.If I have data like this:\[code\]$fields = array( "id" )\[/code\] and \[code\]$values = array( "2", "3" );\[/code\]It means I have to write a sql query to get records from table where (id != 2) and (id != 3). It means 1st record will be fetched.Q: How to write a general single query using php to get data from table using above two data arrays. Thanks
 
Back
Top