php - Array in Where clause -
how can insert array clause? first query id:
$query = "select id #_categories alias = 'agenda'"; $result = mysql_query($query) or die(mysql_error()); while($linha = mysql_fetch_array($result)){ $vnome = $linha['id']; }
now second query final result:
$query = "select introtext $tabela catid in ($vnome) <> ''";
and result is:
select introtext #_content catid in (36) <> ''
why can't put ids in clause in?
ps: sorry bad english, not native language.
$vnome=array(); $result = mysql_query($query) or die(mysql_error()); while($linha = mysql_fetch_array($result)){ $vnome[] = $linha['id']; }
then sql:
$query = "select introtext $tabela catid in (".implode(",",$vnome).")";
Comments
Post a Comment