Solar Posted March 21, 2011 Share Posted March 21, 2011 Like Youtube; when submitting a video; You can insert words into a Textbox named Tags. Each space you leave is considered the start of a new word. How can I do this using PHP + MYSQL. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/231313-textbox-array/ Share on other sites More sharing options...
gizmola Posted March 21, 2011 Share Posted March 21, 2011 All you really need is explode to get the words into an array, and a routine that builds a mysql insert statement. Quote Link to comment https://forums.phpfreaks.com/topic/231313-textbox-array/#findComment-1190505 Share on other sites More sharing options...
Solar Posted March 21, 2011 Author Share Posted March 21, 2011 Can I get an example for the mysql build please? Would I need a simple word in the INSERT statement? I've tried googling (php insert array) but no answers. Quote Link to comment https://forums.phpfreaks.com/topic/231313-textbox-array/#findComment-1190561 Share on other sites More sharing options...
gizmola Posted March 21, 2011 Share Posted March 21, 2011 When you have an array you can foreach through it. $tags = explode(' ', $_POST['tags']); foreach ($tags as $tag) { // do some mysql stuff here } As to what the actual queries should be, that depends on your database structure. You haven't provided us any information on that and there are a variety of approaches to take. Quote Link to comment https://forums.phpfreaks.com/topic/231313-textbox-array/#findComment-1190567 Share on other sites More sharing options...
Solar Posted March 27, 2011 Author Share Posted March 27, 2011 Sorry for the late reply and thanks to your post. Let say I have a single textbox. Everytime you leave a space in this textbox; it counts as a new word. I would like the database/table structure like; idvideoidword 01Hello 11Goodbye 23Testing Every word would have its own entry. I'm still confused and want to know if there is some sort of specific php "name" so I can search for answers. Example; mysql_fetch_row. Quote Link to comment https://forums.phpfreaks.com/topic/231313-textbox-array/#findComment-1192747 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.