I have a query
$query = "INSERT INTO `user`
(`fname`,
`lname`,
`email`,
`password`,
`permission`,
`idcustomer`)
VALUES
(
'" . $firstname . "',
'" . $lastname . "',
'" . $email . "',
'" . $password . "',
'admin',
" . $idcustomer . "
);";
Now, I need to execte this query only is the result of the query below is > 0:
select (number_of_users - (select count(*) from user where idcustomer=2)) availableUsers
from customer where idcustomer=2
Just use a
selectinstead ofvalues(...):