Tuesday, April 7, 2009

if else statement syntax queries mysql php examples

What is that bullshit? this is the worse title I have ever written for a post, but again believe it or not! 29 people are typing this exact text in google every day ( if else statement syntax queries MySQL PHP examples ) and of course get no results.
I know I am getting a lot of traffic to this blog from the MySQL forums, so I don't want the experienced people to be laughing at me now, I just feel like I should help those 29 people out.

So, first thing there's no such thing as "if else" in MySQL since MySQL doesn't have a procedural extention (like Oracle's PL/SQL), this flow control job is usually done withing your programming language (that's not the SQL!!), If you are interested to MySQL, chances are that you are learning/using PHP, the syntaxe to do that in php is the following:
if (condition) { Instructions (may include the execution of SQL statements or anything..) ;}
else { other instructions;}
refer to your php documentation/book for more information.
I hope this helps :)


Me said...

Wrong buddy. Check your facts.

kindyroot said...

can you be more explicit?