In order to fetch data from database (mySql) i am appending my query depending upon user requirement which he chooses from the filters i've given to him. but at a specific point if certain condition is met, so i want to unset a field (submissionDate) which was set to some variable before and set some new field to that variable. For e.g my query is `
$query = "SELECT * FROM table2 WHERE DATE(submissionDate) between '$variablename3' and '$variablename4'"
but if following condition is true
if($variablename8=="Approved")
so i have to Append previous query and add to it
$query = "$query and DATE(newDate) between '$variablename3' and '$variablename4'"
`Note that i am appending it depending upon conditions met. so can't write all query again . Different fields will be set to different values but only if this condition is met i have to unset submissionDate and set newDate field b/w var3 and var4 and unset previous part which was
DATE(submissionDate) between '$variablename3' and '$variablename4'
So basically i have to neglect submissionDate effect while it will remain in the query. is there any possible way to sort this type of problem out ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire