[SOLVED] Putting multiple values from list into one field
Posted: Tue Feb 03, 2004 5:58 pm
Hi there,
I'm kinda stumped on how to do this. I have a list box where I can select multiple things by holding down control (example at: http://www.mypartz.com/example.html). I was wondering how I could get the selected items into a variable so I can put them into one field in my database. The values can be in the variable separated by spaces or commas. This is so I can use my friend's search script on the variable to display certain rows.
When I try it out by using
$query = "INSERT INTO reviews (keywords) VALUES ('$keywords')";
it only puts in the last value selected.
I'm a beginner in php so I don't really know much but as long as it's in a variable I will know what to do.
One other thing is that the search script only searches one field in the database. How can I get it to search multiple fields? Right now it searches the website_link field but I would also like it to search the keywords and website_title field.
Here is the code the search script uses:
$query = "select * FROM reviews WHERE website_link LIKE \"%$trimmed%\"
order by website_link";
Thanks everyone!
I'm kinda stumped on how to do this. I have a list box where I can select multiple things by holding down control (example at: http://www.mypartz.com/example.html). I was wondering how I could get the selected items into a variable so I can put them into one field in my database. The values can be in the variable separated by spaces or commas. This is so I can use my friend's search script on the variable to display certain rows.
When I try it out by using
$query = "INSERT INTO reviews (keywords) VALUES ('$keywords')";
it only puts in the last value selected.
I'm a beginner in php so I don't really know much but as long as it's in a variable I will know what to do.
One other thing is that the search script only searches one field in the database. How can I get it to search multiple fields? Right now it searches the website_link field but I would also like it to search the keywords and website_title field.
Here is the code the search script uses:
$query = "select * FROM reviews WHERE website_link LIKE \"%$trimmed%\"
order by website_link";
Thanks everyone!