I suggest you to try fulltext searchs, wich are better and optimized for this matter. With MySQL fulltext search, you have to create an index containing the fields in your table that you want to search in (fulltext indexes can only be used on MyISAM tables). Once you have created your index, then the sintax to perform the search is: select * from the_table where MATCH(articletitle, articlebody) AGAINST('some search keywords here'); MATCH takes a comma-separated list that names the columns to be searched and AGAINST takes a string that is the search query. Take a look: http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html http://www.onlamp.com/pub/a/onlamp/2003/06/26/fulltext.html
Hope that it helps! ----- Mensaje original ---- De: Tedit kap <[EMAIL PROTECTED]> Para: php_mysql@yahoogroups.com Enviado: sábado, 10 de mayo, 2008 19:40:12 Asunto: [php_mysql] basic search Hi, I have a table like articleid-articleda te-articletitle- articlebody I am looking for a simple php script that will search my database which contains articles against keywords entered by the user...So, it should bring up that article that contains that keyword or words entered by the user. For example: select * from the_table where articletitle or articlebody contains keyword of course this is wrong syntax I guess but I just wrote this to explain what I want: search a certain keyword in article text body and bring the results.... What is the correct syntax? I could not see a "contains" or something like that when I searched.... ____________ _________ _________ _________ _________ _________ _ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile. yahoo.com/ ;_ylt=Ahu06i62sR 8HDtDypao8Wcj9tA cJ [Non-text portions of this message have been removed] ______________________________________________ Enviado desde Correo Yahoo! La bandeja de entrada más inteligente. [Non-text portions of this message have been removed]