MySQL Forums
Forum List  »  PHP

ternary operator inside a query
Posted by: Dimitris Papageorgiou
Date: February 24, 2015 01:19PM

I have this query-it is a prepared statement:
UPDATE appointments
SET Bookfrom=(?),staffID=(?),startDate=(?),endDate=(?) where apID=(?)
AND appointments.bookedfor=(SELECT user_ID
FROM users
WHERE email=(?))

the staffID you see above is related with a variable that IT WILL NOT ALWAYS be available

Αs such I must find a way to rewrite the above query without staffID in it...one solution I though was to use a ternary operator...but I do not know how exactly to implement this from a query/code point of view.

How I could a ternary operator in the query above...staffID=false?....etc

Options: ReplyQuote


Subject
Written By
Posted
ternary operator inside a query
February 24, 2015 01:19PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.