hi guys
i have seen this new line of code and surprised!
mysql_connect('localhost','root','') or testFun();
i know that this is used in db connections
i want to know all the applications of 'or'
guys plz help me
hi guys
i have seen this new line of code and surprised!
mysql_connect('localhost','root','') or testFun();
i know that this is used in db connections
i want to know all the applications of 'or'
guys plz help me
It can be used in any boolean expression.
Well in that expression it meens if it fails to connect to the database (IE the function returns a FALSE value) it will run testFun(); Probably the most common use in that format is
mysql_connect('localhost', 'root', 'password') or die(mysql_error());
which trys to connect to mysql and if it fails it returns the error text and exits the script
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.