jwk811 Posted December 16, 2006 Share Posted December 16, 2006 when i submit a piece of date to a database as a text column would i be able to later then search for individual words in it? like the text will include many different words separated by commas and when i search through that column of all the entries it will show the entire text box because it found just one of them.. lol i hope that makes sense to you, thanks for any help! Link to comment https://forums.phpfreaks.com/topic/30848-can-i-search-for-individual-words-throughout-a-text-entry/ Share on other sites More sharing options...
bljepp69 Posted December 16, 2006 Share Posted December 16, 2006 If you are wanting to do it with mySQL then your call would look something like:"SELECT * FROM table WHERE variable LIKE '%word%'"If you are wanting to search using PHP, check out the strstr() function Link to comment https://forums.phpfreaks.com/topic/30848-can-i-search-for-individual-words-throughout-a-text-entry/#findComment-142248 Share on other sites More sharing options...
jwk811 Posted December 16, 2006 Author Share Posted December 16, 2006 heres my code.. its not working..unexpected T_VARIABLE error[code]if(isset($_POST['find_word'])){$word = $_POST['word'];$word = 'Hich';$sql = "SELECT * FROM dictionary WHERE word LIKE '%$word%'"$result = dbQuery($sql);}else{$sql = "SELECT id, word, pro, pro2, pos, sub, trans, def, ex, date FROM dictionary $where ORDER BY word";$result = dbQuery($sql);}while($row = dbFetchAssoc($result)) { extract($row);}[/code]and this code is basically saying.. if they requested to find a specific word show only that word otherwise display them all.. and ive tried a bunch of things but i cant figure it out Link to comment https://forums.phpfreaks.com/topic/30848-can-i-search-for-individual-words-throughout-a-text-entry/#findComment-142263 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.