I know this may be a stupid question but here goes...
Is there a way to use IF, ELSE etc. in a MySql query in PHP ?
I need to check each variable before updating a field in the DB. I know I can make a Query per IF ELSE but if I could incorporate it in one query it would be great.
IF in MySql Query
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
I found this:
http://www.mysql.com/doc/en/Control_flow_functions.html
But it may be simpler to use PHP to build the query - not write one query per condition but have one query which is dynamic and built based on whatever information needs to be updated.
Mac
http://www.mysql.com/doc/en/Control_flow_functions.html
But it may be simpler to use PHP to build the query - not write one query per condition but have one query which is dynamic and built based on whatever information needs to be updated.
Mac