473,503 Members | 11,018 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help with Selecting Post Codes

I have a table containing names and addresses called tblNames and
constructed as below:

CREATE TABLE tblnames (
strNameReference varchar(6) NOT NULL default '',
strSurname varchar(35) default NULL,
strSchool varchar(75) default NULL,
strTitle varchar(25) default NULL,
strPassword varchar(15) default NULL,
strPostCode varchar(15) default NULL,
strEmail varchar(55) default NULL,
strPasswordHint varchar(35) default NULL,
PRIMARY KEY (strNameReference),
KEY strSurname (strSurname,strSchool,strTitle),
KEY strPostCode (strPostCode)
) TYPE=MyISAM COMMENT='Names Table';

The UK Post Code goes on the lines of "CB7 7TS" with a space between the
two parts of the post code.

If the following SELECT statement is used:

SELECT * FROM `tblnames` WHERE strPostCode like 'CB4 3DZ' LIMIT 0, 30

Then MYsql returns no records but no errors either and PHPMYAdmin states
that:

"Your SQL-query has been executed successfully"

Any help will be appreciated.

Thank you.
Stephen Layton


Jul 20 '05 #1
8 1259
st************@btinternet.REMOVESPAMcom wrote:
I have a table containing names and addresses called tblNames and
constructed as below:


There is nothing wrong with the table or with the query. Only reason why
you would get zero rows is that you don't have a row in your table where
strPostCode is 'CB4 3DZ'.

I tested it like this:

# insert one test row to table
insert into tblnames values('x','x','x','x','x','CB4 3DZ','x','x');

# select rows where strPostCode matches
SELECT * FROM `tblnames` WHERE strPostCode like 'CB4 3DZ' LIMIT 0, 30;
Jul 20 '05 #2
st************@btinternet.REMOVESPAMcom wrote:
I have a table containing names and addresses called tblNames and
constructed as below:


There is nothing wrong with the table or with the query. Only reason why
you would get zero rows is that you don't have a row in your table where
strPostCode is 'CB4 3DZ'.

I tested it like this:

# insert one test row to table
insert into tblnames values('x','x','x','x','x','CB4 3DZ','x','x');

# select rows where strPostCode matches
SELECT * FROM `tblnames` WHERE strPostCode like 'CB4 3DZ' LIMIT 0, 30;
Jul 20 '05 #3
Aggro

Many thanks for your reply following which, I have checked my Access
Code which takes the Access table and transfers it to a comma separated
text file. I've just found that it was adding a separate space in the
Post Code ... so it did not find the required field.

Thank you for your help..

In message <q%***************@read3.inet.fi>, Aggro
<sp**********@yahoo.com> writes
I have a table containing names and addresses called tblNames and
constructed as below:


There is nothing wrong with the table or with the query. Only reason
why you would get zero rows is that you don't have a row in your table
where strPostCode is 'CB4 3DZ'.

I tested it like this:

# insert one test row to table
insert into tblnames values('x','x','x','x','x','CB4 3DZ','x','x');

# select rows where strPostCode matches
SELECT * FROM `tblnames` WHERE strPostCode like 'CB4 3DZ' LIMIT 0, 30;


Stephen Layton
Jul 20 '05 #4
Aggro

Many thanks for your reply following which, I have checked my Access
Code which takes the Access table and transfers it to a comma separated
text file. I've just found that it was adding a separate space in the
Post Code ... so it did not find the required field.

Thank you for your help..

In message <q%***************@read3.inet.fi>, Aggro
<sp**********@yahoo.com> writes
I have a table containing names and addresses called tblNames and
constructed as below:


There is nothing wrong with the table or with the query. Only reason
why you would get zero rows is that you don't have a row in your table
where strPostCode is 'CB4 3DZ'.

I tested it like this:

# insert one test row to table
insert into tblnames values('x','x','x','x','x','CB4 3DZ','x','x');

# select rows where strPostCode matches
SELECT * FROM `tblnames` WHERE strPostCode like 'CB4 3DZ' LIMIT 0, 30;


Stephen Layton
Jul 20 '05 #5
You can use TRIM() to process input (or just update ) as well and change
postal code field length to 6.
It will save memory a bit.

Khazret Sapenov
"Stephen Layton" <st*****@stephenlayton.org> wrote in message
news:1w**************@stephenlayton.org...
Aggro

Many thanks for your reply following which, I have checked my Access
Code which takes the Access table and transfers it to a comma separated
text file. I've just found that it was adding a separate space in the
Post Code ... so it did not find the required field.

Thank you for your help..

In message <q%***************@read3.inet.fi>, Aggro
<sp**********@yahoo.com> writes
I have a table containing names and addresses called tblNames and
constructed as below:


There is nothing wrong with the table or with the query. Only reason
why you would get zero rows is that you don't have a row in your table
where strPostCode is 'CB4 3DZ'.

I tested it like this:

# insert one test row to table
insert into tblnames values('x','x','x','x','x','CB4 3DZ','x','x');

# select rows where strPostCode matches
SELECT * FROM `tblnames` WHERE strPostCode like 'CB4 3DZ' LIMIT 0, 30;


Stephen Layton

Jul 20 '05 #6
You can use TRIM() to process input (or just update ) as well and change
postal code field length to 6.
It will save memory a bit.

Khazret Sapenov
"Stephen Layton" <st*****@stephenlayton.org> wrote in message
news:1w**************@stephenlayton.org...
Aggro

Many thanks for your reply following which, I have checked my Access
Code which takes the Access table and transfers it to a comma separated
text file. I've just found that it was adding a separate space in the
Post Code ... so it did not find the required field.

Thank you for your help..

In message <q%***************@read3.inet.fi>, Aggro
<sp**********@yahoo.com> writes
I have a table containing names and addresses called tblNames and
constructed as below:


There is nothing wrong with the table or with the query. Only reason
why you would get zero rows is that you don't have a row in your table
where strPostCode is 'CB4 3DZ'.

I tested it like this:

# insert one test row to table
insert into tblnames values('x','x','x','x','x','CB4 3DZ','x','x');

# select rows where strPostCode matches
SELECT * FROM `tblnames` WHERE strPostCode like 'CB4 3DZ' LIMIT 0, 30;


Stephen Layton

Jul 20 '05 #7
You can use TRIM() to process input (or just update ) as well and change
postal code field length to 6.
It will save memory a bit.

Khazret Sapenov
"Stephen Layton" <st*****@stephenlayton.org> wrote in message
news:1w**************@stephenlayton.org...
Aggro

Many thanks for your reply following which, I have checked my Access
Code which takes the Access table and transfers it to a comma separated
text file. I've just found that it was adding a separate space in the
Post Code ... so it did not find the required field.

Thank you for your help..

In message <q%***************@read3.inet.fi>, Aggro
<sp**********@yahoo.com> writes
I have a table containing names and addresses called tblNames and
constructed as below:


There is nothing wrong with the table or with the query. Only reason
why you would get zero rows is that you don't have a row in your table
where strPostCode is 'CB4 3DZ'.

I tested it like this:

# insert one test row to table
insert into tblnames values('x','x','x','x','x','CB4 3DZ','x','x');

# select rows where strPostCode matches
SELECT * FROM `tblnames` WHERE strPostCode like 'CB4 3DZ' LIMIT 0, 30;


Stephen Layton

Jul 20 '05 #8
You can use TRIM() to process input (or just update ) as well and change
postal code field length to 6.
It will save memory a bit.

Khazret Sapenov
"Stephen Layton" <st*****@stephenlayton.org> wrote in message
news:1w**************@stephenlayton.org...
Aggro

Many thanks for your reply following which, I have checked my Access
Code which takes the Access table and transfers it to a comma separated
text file. I've just found that it was adding a separate space in the
Post Code ... so it did not find the required field.

Thank you for your help..

In message <q%***************@read3.inet.fi>, Aggro
<sp**********@yahoo.com> writes
I have a table containing names and addresses called tblNames and
constructed as below:


There is nothing wrong with the table or with the query. Only reason
why you would get zero rows is that you don't have a row in your table
where strPostCode is 'CB4 3DZ'.

I tested it like this:

# insert one test row to table
insert into tblnames values('x','x','x','x','x','CB4 3DZ','x','x');

# select rows where strPostCode matches
SELECT * FROM `tblnames` WHERE strPostCode like 'CB4 3DZ' LIMIT 0, 30;


Stephen Layton

Jul 20 '05 #9

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

Similar topics

5
2866
by: CaliSchmuck | last post by:
I think this is probably simple, but I'm having a problem figuring it out. I have a form that is used to enter data. I want users to be able to enter a zip code in the form, and have the city...
3
3688
by: Dan Trowbridge | last post by:
Hi everyone, In my attempt to port code from VS 6.0 to VS.NET I had some code break along the way, mostly due to not adhereing closely to the C++ standard. This may be another instance but I...
1
1443
by: emmah | last post by:
Dear Everyone, I have a small but hopefully simple problem. Please forgive my misuse of technical terminology but I am hoping someone can provide some advise. We have a database of nearly 1.6...
15
3294
by: Simon Gare | last post by:
Hi, trying to retrieve postal codes from the db but only want the query to look at the first 3 digits of the code tried using (LEFT(dbo.booking_form.COLL_POST_CODE),3) but that doesn't work. I...
10
3328
by: JonathanOrlev | last post by:
Hello everybody, I wrote this comment in another message of mine, but decided to post it again as a standalone message. I think that Microsoft's Office 2003 help system is horrible, probably...
3
2995
by: cuties | last post by:
Hi all.... i'm very new to this programming language. i'm required to fulfill this task in the company i'm doing my practical. i hope i can get guide for my problem... Here is the script i...
2
1549
by: rocksoft | last post by:
Hi I am working in asp.net with C# web application, I have used visual studio 2003, i have used dropdownlist in my application to populate the data from mysql database, i have got problem while...
0
1173
by: Satiz | last post by:
Hi All, I've a TreeView(IE Webcontrol) and a DataGrid in my VS.Net 2003 ASP.Net web form. My problem : If i select a particular node(it may be parent, child or leaf), then the corresponding...
5
11617
by: Matt B | last post by:
I know this is a bit of nonstandard behavior, but I would like the Enter key to move focus through a group of radiobuttons without selecting them. The user would then have to use Space or actually...
0
7207
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
7294
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,...
0
7361
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...
1
7015
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
7470
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...
0
5602
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,...
0
4693
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
3183
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...
1
749
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.