we've been struggling to some situations in PHP wherein some of the queries don't work. We've found out that the non-working-queries occurs only if the last query executed has a comment in it.
In php, we have something like this:
$getUsersQuery = "SELECT * from `users` where active = 1; ##DEVELOPER: JOE";
$getUsersStmt = $con->prepare($getUsersQuery);
$getUsersStmt->execute();
$users = $getUsersStmt->fetchAll();
$getProductsQuery = "SELECT * from `products` where active = 1; ##DEVELOPER: JOE";
$getProductsStmt = $con->prepare($getProductsQuery);
$getProductsStmt->execute();
$products = $getProductsStmt->fetchAll();
For the $users variable, it contains accurate data, but in $products variable, it contains nothing. After moments of configuring, we got a theory that it's because the last query executed has comment ##DEVELOPER: JOE on it. We removed the comment of the first query, and the second query worked. We've tested it, and the theory is proven. Btw, we are using MySql and PHP 5.
We now know the reason how it occurs. But our question is that, why is it occurring?
If you have ideas, please do comment it out. That will be a big help for us. Thanks.