473,795 Members | 2,391 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Search function

Hi all

I have a search function on a site of mine. At the moment, the content is
delivered using this:

<?php echo $row_Recordset1['content']; ?>

The search function goes through the table and displays the titles of the
pages that contain the term.

What I'd like to do is set it up so that when the visitor clicks on a title,
it sends the search term as well, looks for it in
$row_Recordset1['content']; and puts <strong> before and </strong> after.

Does that make sense?

Also, I've just noticed something not right. The CMS takes a text box and
writes the HTML into the table. So, if I do a search on </li> for example,
then it brings back results. I can't even begin to imagine a way round
this. In most cases this is unlikely to be a problem but I'd like to think
there might be a way round it.

Any help would be gratefully received.

Andy

Jul 17 '05 #1
3 1763
convert < and > to &lt; and &gt; using html_specialcha racters() - ive prob
got the function name wrong -. and then search using that.

- Ali

"Andy Jacobs" <an**@redcatmed ia.net> wrote in message
news:BE92B1B4.5 E93%an**@redcat media.net...
Hi all

I have a search function on a site of mine. At the moment, the content is
delivered using this:

<?php echo $row_Recordset1['content']; ?>

The search function goes through the table and displays the titles of the
pages that contain the term.

What I'd like to do is set it up so that when the visitor clicks on a
title,
it sends the search term as well, looks for it in
$row_Recordset1['content']; and puts <strong> before and </strong> after.

Does that make sense?

Also, I've just noticed something not right. The CMS takes a text box and
writes the HTML into the table. So, if I do a search on </li> for
example,
then it brings back results. I can't even begin to imagine a way round
this. In most cases this is unlikely to be a problem but I'd like to
think
there might be a way round it.

Any help would be gratefully received.

Andy

Jul 17 '05 #2


On 25/4/05 3:24 pm, in article 42******@nntpho st.cis.strath.a c.uk, "Alistair
Baillie SS2002" <ab******@cis.s trath.ac.uk> wrote:
convert < and > to &lt; and &gt; using html_specialcha racters() - ive prob
got the function name wrong -. and then search using that.

- Ali

But then doing a search on /li would still work, or any other HTML tags,
just without the <>.

I'm not convinced that it's a major problem as I can't think that anyone
using a site would be searching using HTML anyway. I've been trying to
think of something where a 'real' word that someone would search for might
also be an html tag but it's going to be rare, I think.

Andy

"Andy Jacobs" <an**@redcatmed ia.net> wrote in message
news:BE92B1B4.5 E93%an**@redcat media.net...
Hi all

I have a search function on a site of mine. At the moment, the content is
delivered using this:

<?php echo $row_Recordset1['content']; ?>

The search function goes through the table and displays the titles of the
pages that contain the term.

What I'd like to do is set it up so that when the visitor clicks on a
title,
it sends the search term as well, looks for it in
$row_Recordset1['content']; and puts <strong> before and </strong> after.

Does that make sense?

Also, I've just noticed something not right. The CMS takes a text box and
writes the HTML into the table. So, if I do a search on </li> for
example,
then it brings back results. I can't even begin to imagine a way round
this. In most cases this is unlikely to be a problem but I'd like to
think
there might be a way round it.

Any help would be gratefully received.

Andy



Jul 17 '05 #3
other than the words Strong, and Quote, I dont think you'll get any, and
assuming you use <b> then strong wont be a problem.

I beleive you can use Regular expressions within SQL searches, u could try
doing a search for where the wrod exists, but is not within a < > ?

but as you said, its unlikley to be a problem thats worth bothering about.

- ali

"Andy Jacobs" <an**@redcatmed ia.net> wrote in message
news:BE92C371.5 EAB%an**@redcat media.net...


On 25/4/05 3:24 pm, in article 42******@nntpho st.cis.strath.a c.uk,
"Alistair
Baillie SS2002" <ab******@cis.s trath.ac.uk> wrote:
convert < and > to &lt; and &gt; using html_specialcha racters() - ive
prob
got the function name wrong -. and then search using that.

- Ali


But then doing a search on /li would still work, or any other HTML tags,
just without the <>.

I'm not convinced that it's a major problem as I can't think that anyone
using a site would be searching using HTML anyway. I've been trying to
think of something where a 'real' word that someone would search for might
also be an html tag but it's going to be rare, I think.

Andy

"Andy Jacobs" <an**@redcatmed ia.net> wrote in message
news:BE92B1B4.5 E93%an**@redcat media.net...
Hi all

I have a search function on a site of mine. At the moment, the content
is
delivered using this:

<?php echo $row_Recordset1['content']; ?>

The search function goes through the table and displays the titles of
the
pages that contain the term.

What I'd like to do is set it up so that when the visitor clicks on a
title,
it sends the search term as well, looks for it in
$row_Recordset1['content']; and puts <strong> before and </strong>
after.

Does that make sense?

Also, I've just noticed something not right. The CMS takes a text box
and
writes the HTML into the table. So, if I do a search on </li> for
example,
then it brings back results. I can't even begin to imagine a way round
this. In most cases this is unlikely to be a problem but I'd like to
think
there might be a way round it.

Any help would be gratefully received.

Andy


Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8731
by: Les Juby | last post by:
A year or two back I needed a search script to scan thru HTML files on a client site. Usual sorta thing. A quick search turned up a neat script that provided great search results. It was fast, returned the hyperlinked page title, filename, and the body txt (30 preceding and following words) in context with the search word highlighted. Excellent.! See it working at: http://www.ipt.co.za Just search for "firearm"
4
2680
by: Ken Fine | last post by:
I'm looking to find or create an ASP script that will take a string, examine it for a search term, and if it finds the search term in the string, return the highlighted search term along with the words that surround it. In other words, I want the search term highlighted and shown in an excerpt of the context in which it appears. Any suggestions or pointers? This behavior is most often seen as part of a search engine. In my case, I want...
3
2229
by: Liz Malcolm | last post by:
Hello and TIA for guidance. I am building a reusable search procedure (thanks go to Graham Thorpe for his example that set me on my way). Everything works up until the 2nd match is found, the command doesn't go to the third match, it exits out of the loop. I've read everything I could find in NG's, but I can't figure out where I'm going wrong. Here is my code. Function cmdSearch(ctlSearchText As Control, ctlFoundText As Control,...
5
2639
by: pembed2003 | last post by:
Hi all, I need to write a function to search and replace part of a char* passed in to the function. I came up with the following: char* search_and_replace(char* source,char search,char* replace){ char* result; size_t l = strlen(source), r = strlen(replace), i; int number_of_replaces = 0; for(i = 0; i < l; i++){ if(source == search)
2
2277
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. Is there a way to start, pause and resume a recurrsive search exactly where you left off, say in the registry programmatically? -- Michael Bragg, President eSolTec, Inc. a 501(C)(3) organization MS Authorized MAR looking for used laptops for developmentally disabled.
4
2171
by: BenCoo | last post by:
Hello, In a Binary Search Tree I get the error : Object must be of type String if I run the form only with the "Dim bstLidnummer As New BinarySearchTree" it works fine. Thanks for any help on this, Benny
4
2516
by: ravindarjobs | last post by:
hi...... i am using ms access 2003,vb6 i have a form. in that i have 2 buttons 1. start search 2 stop search when i click the "start search" button the fucntion SearchSystem() is called, it will search for a particular file in the computer(searches entire drives).
0
1426
by: kang jia | last post by:
hi currently i am doing this search function for car booking website. it can search through either car seats or CarModel. it seems it able to do search function, however i small problem occurs to me. As i would also like to show the customer whether the car is available or not available. Basically it is car status at the moment. However, i am not sure how to do this. my ideas is that if car_inventory>0, show available, otherwise show Not...
0
6982
by: Atos | last post by:
Binary search is used to locate a value in a sorted list of values. It selects the middle element in the array of sorted values, and compares it with the target value; that is the key we are searhing for in the array. If it islower than the target value then the search is made after that middle element and till the end of the array. If it is equal then the target value is found and the middle is returned. Otherwise, search is made from the...
0
10438
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10214
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10164
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9042
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.