I'm looking for some guidance on how to develop a msql query that loops through elemenets in a php array. The array is constructed from a multiple line list box.
nibbler 0 Newbie Poster
Recommended Answers
Jump to PostDo you want a single query where the values in your array are in the where ? Like this:
$values = implode(",", $your_array); $query = "SELECT * FROM table WHERE column IN ($values)"
Jump to PostCan you tell me what's not working ?
If nothing is displayed, perhaps because you need to
<?php echo $newArray["BNF_Name"]; ?>
I don't know if your site is setup to use <?= as a short tag for echo.
Jump to PostYour values are string, and therefor all need to be in separate quotes whithin the IN (...). I was expecting id's (integers) and then they are not needed. My apologies.
All 9 Replies
pritaeas 2,211 ¯\_(ツ)_/¯ Moderator Featured Poster
nibbler 0 Newbie Poster
pritaeas 2,211 ¯\_(ツ)_/¯ Moderator Featured Poster
oldcat 0 Newbie Poster
nibbler 0 Newbie Poster
nibbler 0 Newbie Poster
nibbler 0 Newbie Poster
pritaeas 2,211 ¯\_(ツ)_/¯ Moderator Featured Poster
nibbler 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.