Re: [PHP-DB] full text search and how to underline keyword in results
Hi Andy, In answer to part two - here's a snippet of code I use to highlight relevant words in red - hope it helps to put you on the right track. for ($i=0; $i count($keywords); $i++) { $blurb = eregi_replace( .$keywords[$i]. , font color=\#FF\.$keywords[$i]./font , $blurb); } where $keywords is an array containing all the words searched for and $blurb is the snippet that is returned with the search results At this stage in the flow, I've already retrieved relevant records - this is in fact the last step before I format and display the results.. Hope this helps stuart - Original Message - From: andy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, August 25, 2002 9:32 PM Subject: [PHP-DB] full text search and how to underline keyword in results Hi there, I am trying to write a php script to perform a full text search on a mysql db. I do a match against... and it digs out some results out of the db. There are 2 problems: 1. How can I restrict the results to e.g. 100 characters, but to make sure the keyword is within this 100 characters? 2. Is it possible with php to underline the keyword inside the search results. This might be more tricky. Thank you for any help on that, Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] full text search and how to underline keyword in results
Yeah I had the same problem - also with question marks, quotes etc - I couldn't figure out a fix for it - if you do - please lemme know! cheers stuart - Original Message - From: andy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, August 25, 2002 11:40 PM Subject: Re: [PHP-DB] full text search and how to underline keyword in results for ($i=0; $i count($keywords); $i++) { $blurb = eregi_replace( .$keywords[$i]. , font color=\#FF\.$keywords[$i]./font , $blurb); } Hello Stuart, great, thats a first success and works fast. There are just 2 things which fail on this function: 1. Problems with full stops. A word with a full stop will be ignored (e.g singapore. will not be found if you search for singapore) 2. If you search for singapore and there is a hit Singapore (notice the capital!) will be replaced with singapore in the text. I tryed to fix that, but I fear that my php experiance lacks on this stage :-( Maybe someone else or you do have a idea for a fix? Cheers Andy Stuart McDonald [EMAIL PROTECTED] schrieb im Newsbeitrag 001901c24c45$2a5e6940$0100a8c0@stuart">news:001901c24c45$2a5e6940$0100a8c0@stuart... Hi Andy, In answer to part two - here's a snippet of code I use to highlight relevant words in red - hope it helps to put you on the right track. for ($i=0; $i count($keywords); $i++) { $blurb = eregi_replace( .$keywords[$i]. , font color=\#FF\.$keywords[$i]./font , $blurb); } where $keywords is an array containing all the words searched for and $blurb is the snippet that is returned with the search results At this stage in the flow, I've already retrieved relevant records - this is in fact the last step before I format and display the results.. Hope this helps stuart - Original Message - From: andy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, August 25, 2002 9:32 PM Subject: [PHP-DB] full text search and how to underline keyword in results Hi there, I am trying to write a php script to perform a full text search on a mysql db. I do a match against... and it digs out some results out of the db. There are 2 problems: 1. How can I restrict the results to e.g. 100 characters, but to make sure the keyword is within this 100 characters? 2. Is it possible with php to underline the keyword inside the search results. This might be more tricky. Thank you for any help on that, Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] want to compare text input with blob field
Funny, I just had the same problem! I converted the blob column to a text column and then the problem went away. This page may be of use from the MySQL manual: http://www.mysql.com/doc/en/Case_Sensitivity_Operators.html But I couldn't get their solution to work, so I changed the format of the column to TEXT and it works fine. Cheers stuart - Original Message - From: Smita Manohar [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 22, 2002 3:51 PM Subject: [PHP-DB] want to compare text input with blob field hii im using php with mysql 3.23 in my script im accepting text input and want to compare it with the field which is of the type blob. trying with following query. SELECT * from table where fieldname LIKE '% $textinupt %' but it is giving case sensitive result bcos the field which im comparing with text input is blob. what should i do to avoid case sensitive result??? is it required to convert input text also in boob format?? then how to do that?? thnx and regds, smita. _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] keeping form field data when reloading a form
Are you setting the variables in the form? Something like this - note the value field in the username field: form method=post action=index.php name=loginuser table summary=layout table to hold login data width=300 align=center cellpadding=1 cellspacing=0 border=0 bgcolor=#ff tr td align=leftp class=smallbUsername:/b/p/td td align=leftinput type=text name=username value=?php echo $username;? maxlength=50 size=15 style=width: 120px; font-size: 12px/td /tr tr td align=left p class=smallbPassword:/b/p/td td align=leftinput type=password name=password maxlength=50 size=15 style=width: 120px; font-size: 12px /tr tr td align=leftpnbsp; /p/td td align=leftpinput type=submit value=login name=login style=width: 50px; heigth: 18px; font-size: 12px/p/td /tr /table /form This way, depending on how youare refreshing the login form, if the $username variable passed your validation tests it should be set automatically into the form. Cheers Stuart - Original Message - From: [EMAIL PROTECTED] To: PHP_DB [EMAIL PROTECTED] Sent: Wednesday, August 21, 2002 12:58 AM Subject: [PHP-DB] keeping form field data when reloading a form I have my email checker working now, and all the other fields are checked also, but when I do enter some wrong data the form is reloaded with all blank fields. I'm sure there is a way to keep the existing data in the fields so the end-user will only have to change the incorrect fields, and not have to re-enter all the data. But how? -- Chip Wiegand Computer Services Simrad, Inc www.simradusa.com [EMAIL PROTECTED] There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corporation, 1977 (They why do I have 9? Somebody help me!) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Problem with ntext using php4 on mssql7
Whenever I try to query an ntext field using php4 (on IIS/MSSQL) I get the following error: MS SQL message: ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier. Does anyone have any suggestions for how to solve this issue? Thanks in advance Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]