I have this query of MySQL,
return $this->resultQuery("SELECT COUNT(home_id) AS total
FROM `".$this->table_prefix."user_homes`
WHERE user_id = $assign_id ".
($home_cfg_id ? 'AND `home_cfg_id` IN (
SELECT `home_cfg_id`
FROM `'.$this->table_prefix.'server_homes`
WHERE home_cfg_id = '.$home_cfg_id' )': ''));
but still got error when i run this query
As requested, I'm putting this in an answer. You are missing a concatenating .
at the end of your query string, after $home_cfg_id
.
When debugging something like this, it is often helpful to do as @xQbert suggested, and output the sql string. This will allow you to review the query for anything that looks wrong - as well as (possibly) give a clearer PHP error if the string is created incorrectly.
return $this->resultQuery("SELECT COUNT(home_id) AS total
FROM `".$this->table_prefix."user_homes`
WHERE user_id = $assign_id ".
($home_cfg_id ? 'AND `home_cfg_id` IN (
SELECT `home_cfg_id`
FROM `'.$this->table_prefix.'server_homes`
WHERE home_cfg_id = '.$home_cfg_id.' )': ''));
^
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments