I’m not 100% comfortable with a PHP class defined here: mysqli
I stripped out the guts to shorten it somewhat and get a parse error at runtime.
<?php
function query($x)
{
if ($x > 8) {
return 'greater than eight!';
} else {
return true;
}
} else {
exit();
}
}
print query(7);
It’s the same construct (I think) as the original, isn’t it? Apart from the signature and the body of the method of course. I haven’t come across an if else else clause before and it somehow doesn’t ‘feel right’ for me at least logically wise. Moreover my code won’t compile. Maybe you can set me straight?
Do you have any examples of how it may be used?
Secondly, from the original class – where or how does the $resource variable come into it? In what context would the object get passed a $resource variable?
My client code may be:
$db = new MySQLi;
$db->query("SELECT * FROM my_table");
but I don’t see how $resource comes into play?
I assume you’re trying to do something different but I hope this helps to explains how you can tie three conditions together.