Jump to content
powie.de Tech Forum
Sign in to follow this  
ha197430

WHERE = array

Recommended Posts

Hallo!


In der Where Klausel soll nach bestimmten "ID" selektiert werden. Ich übergebe dem SQL String einen Array mit z.B drei Werten



Array ( [0] => Array ( [0] => Array ( [key_list] => 92 ) [1] => Array ( [key_list] => 93 ) [2] => Array ( [key_list] => 94 ) ) ) Array



Und meine Query sieht so aus


SELECT kl.list_id,

       l.headline AS headline

       FROM keywords_lists AS kl

       LEFT JOIN lists AS l ON l.id = kl.list_id

       WHERE kl.keyword_id = '$key_list'




Die $key_list ist mein ARRAY, wie kann ich es hinbekommen, dass er nach allen drei "ID" prüft ?


DANKE

Share this post


Link to post
Share on other sites

3 abfragen?

die foreach stimmt schon, aber so ist doch schöner

 $wert)
   $in.=",".$wert;

$qry="SELECT kl.list_id,
l.headline AS headline
FROM keywords_lists AS kl
LEFT JOIN lists AS l ON l.id = kl.list_id
WHERE kl.keyword_id IN (".substr($in,1).")";
?>

 

sollte gehen.


gruß Hener

Share this post


Link to post
Share on other sites
Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×