473,472 Members | 1,719 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

search question

54 New Member
hello. I have a question about my search function in my php page. I have a search function that when the user types the ID# in it will return all the data from the database connected to that id#. My problem is that I have over 350 numbers and if I search for instance the number 15 .. it returns all the data for 15,5,150,151. How do I get it to just recognize just the number 15???

here is the code i use to collect the input number and search table.

Expand|Select|Wrap|Line Numbers
  1. $term=$_POST['term'];
  2. $sql= mysql_query("select * from collection_data  where edwards  like '%$term%'");
  3.  
any help would be great thanks.
Dec 1 '09 #1
4 1461
dlite922
1,584 Recognized Expert Top Contributor
don't use LIKE comparison in your SQL. use an equal sine: edwards = '$term'

Please Please PLEASE sanitize your variable before putting them in SQL.

Read this:
http://www.tizag.com/mysqlTutorial/m...-injection.php



Dan
Dec 1 '09 #2
hsriat
1,654 Recognized Expert Top Contributor
Use of fulltext search is recommended in such case.
Dec 1 '09 #3
dlite922
1,584 Recognized Expert Top Contributor
@hsriat
in which case? I think he's looking for a boolean search. Either to equal or not equal.


Dan
Dec 1 '09 #4
hsriat
1,654 Recognized Expert Top Contributor
in which case? I think he's looking for a boolean search. Either to equal or not equal.


Dan
I see... I didn't read properly, I thought he was trying to get 15 from within some text.

Thanks for correcting. :)
Dec 2 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Steve K | last post by:
After reading Harlan's post about popups some of my questions were answered but.. I was going to use differnet popups on a lot of my pages. These popups contain bios on Cornell faculty. Two days...
2
by: Rafael Nenninger | last post by:
This question has to do with MS file search but it is happening only with ..asp pages, so I though someone programming with .asp pages has experienced the same situation. I'm trying to find .asp...
0
by: Anurag | last post by:
Hi, I understand that the dbm cfg parameter "DISCOVER" controls whether Search or Known discovery is applicable. Additionally, Search discovery provides a superset of Known discovery. I completely...
19
by: RAJASEKHAR KONDABALA | last post by:
Hi, Does anybody know what the fastest way is to "search for a value in a singly-linked list from its tail" as oposed to its head? I am talking about a non-circular singly-linked list, i.e.,...
28
by: joshc | last post by:
If I have an array of data that I know to be sorted in increasing order, and the array is less than 50 elements, and I want to find the first element greater than a certain value, is a simple...
60
by: Julie | last post by:
What is the *fastest* way in .NET to search large on-disk text files (100+ MB) for a given string. The files are unindexed and unsorted, and for the purposes of my immediate requirements, can't...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
0
by: | last post by:
I have a question about spawning and displaying subordinate list controls within a list control. I'm also interested in feedback about the design of my search application. Lots of code is at the...
26
by: mike-yue | last post by:
The topic comes from a question: Would you rather wait for the results of a quicksort, a linear search, or a bubble sort on a 200000 element array? 1Quicksort 2Linear Search 3Bubble Sort ...
12
by: jotr | last post by:
I posted this question already (Admin Edit Need help with my search macro for excel), but I made a mistake in writing the question, so I posted a reply and I am afraid that at a glance it may be...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
1
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...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
muto222
php
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.