ameyjah Posted March 29, 2009 Share Posted March 29, 2009 Hi friends, I want to create lyrics finder website like http://www.azlyrics.com/ . But i am not able to decide to fetch the data from my database. Because most of the time, entered query will not be exact. My Databse Structure: Assume there are following fields 1) actual lyrics text 2) author name 3) tags All of the above fields are text. so if i want to find the song called 'blah blah blah', how do i fire a query. Because using mysql, you can just find whether some records exists if id of song is something something.. but as i am not using any primary key, as user can not remember all primary keys, i am not able to decide, how should i approach this problem. Link to comment https://forums.phpfreaks.com/topic/151577-want-to-develop-lyrics-finder-php-site-need-help/ Share on other sites More sharing options...
Silverado_NL Posted March 29, 2009 Share Posted March 29, 2009 i think u are looking for the mysql comparison statement called LIKE. here some info about it. http://www.htmlite.com/mysql011.php u can find alot more info if u google it. it basicly compare's strings and returns any if matched. your query would look something like this. $search_string = 'words to find'; $resource = mysql_query("SELECT * FROM lyrics WHERE lyric_text LIKE '%$search_string%'"); hope this helps Link to comment https://forums.phpfreaks.com/topic/151577-want-to-develop-lyrics-finder-php-site-need-help/#findComment-796090 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.