Hi,
my sql query does not work -
SELECT * FROM representative where PinCode_Covered=110065
-
In PinCode_Covered column i have more than one values like
110065, 110061, 110033
and in other rows i have
110065
But it fetch only one record where 110065 exist; why other value not come in search. Any one plz help me out.
15 1498
Hi,
my sql query does not work
SELECT * FROM representative where PinCode_Covered=110065
In PinCode_Covered column i have more than one values like
110065, 110061, 110033
and in other rows i have
110065
But it fetch only one record where 110065 exist; why other value not come in search. Any one plz help me out.
hi,
im not sure wat u mean exactly.....
r u trying to say that the result that is displayed is only for 110065
and not the rest of the values???
regards,
ajos
hi,
im not sure wat u mean exactly.....
r u trying to say that the result that is displayed is only for 110065
and not the rest of the values???
regards,
ajos
hi ajos,
yes!
I want all the rows where PinCode_covered = 110065
hi ajos,
yes!
I want all the rows where PinCode_covered = 110065
firstly check how many rows are there with the above pincode u mentioned....im not exactly sure abt this....check ur query
Hi,
my sql query does not work
SELECT * FROM representative where PinCode_Covered=110065
In PinCode_Covered column i have more than one values like
110065, 110061, 110033
and in other rows i have
110065
But it fetch only one record where 110065 exist; why other value not come in search. Any one plz help me out.
You have filtered your results by your where clause. Perhaps you should go through a tutorial about what where does.
Edit: Are you sure the other tables have the same value? Perhaps there are some leading or trailing spaces. What type is the PinCode_Covered column?
You have filtered your results by your where clause. Perhaps you should go through a tutorial about what where does.
Edit: Are you sure the other tables have the same value? Perhaps there are some leading or trailing spaces. What type is the PinCode_Covered column?
I don't have too much time to search in toturial. There is no spaces. i have taken varchar datatype for PinCode_Covered column.
I don't have too much time to search in toturial. There is no spaces. i have taken varchar datatype for PinCode_Covered column.
How do you know that there are no spaces, did you try the query using the TRIM function?
How do you know that there are no spaces, did you try the query using the TRIM function?
I have not checked by TRIM function but i am describing how i stored values
----------------------------
PinCode_Covered
--------------------------
201001
-------------------------
110065, 110061, 110066
-------------------------
110065
-------------------------
110065, 110033, 110001
-------------------------
It is showing only 110065 but it has to display other column also where PinCode is 110065.
Now i think u can understand my problem better.
I have not checked by TRIM function but i am describing how i stored values
----------------------------
PinCode_Covered
--------------------------
201001
-------------------------
110065, 110061, 110066
-------------------------
110065
-------------------------
110065, 110033, 110001
-------------------------
It is showing only 110065 but it has to display other column also where PinCode is 110065.
Now i think u can understand my problem better.
So you have multiple values?
Use like with %
as in - where PinCode_Covered like '%110065%'
So you have multiple values?
Use like with %
as in - where PinCode_Covered like '%110065%'
Thanks buddy
It works, but when i attach the query in my php application it displays the single one again.
Thanks buddy
It works, but when i attach the query in my php application it displays the single one again.
Post the code that you have changed for it.
Also make sure you saved the changes.
Post the code that you have changed for it.
Also make sure you saved the changes.
------
The code in which i used the query as follows
----- -
<?
-
$Pin_Code = '110065';
-
$result=mysql_query("SELECT * FROM tablename where PinCode_Covered LIKE '$Pin_Code'");
-
$num=mysql_num_rows($result);
-
-
while($row = mysql_fetch_array($resultbb, MYSQL_ASSOC))
-
{
-
$PinCode_Covered=$row['PinCode_Covered'];
-
echo "{$row['PinCode_Covered']}"; } ?>
------
The code in which i used the query as follows
-----
<?
$Pin_Code = '110065';
$result=mysql_query("SELECT * FROM tablename where PinCode_Covered LIKE '$Pin_Code'");
$num=mysql_num_rows($result);
while($row = mysql_fetch_array($resultbb, MYSQL_ASSOC))
{
$PinCode_Covered=$row['PinCode_Covered'];
echo "{$row['PinCode_Covered']}"; } ?>
hey can u tell me why its happening and how to solve this problem?
------
The code in which i used the query as follows
-----
<?
$Pin_Code = '110065';
$result=mysql_query("SELECT * FROM tablename where PinCode_Covered LIKE '$Pin_Code'");
$num=mysql_num_rows($result);
while($row = mysql_fetch_array($resultbb, MYSQL_ASSOC))
{
$PinCode_Covered=$row['PinCode_Covered'];
echo "{$row['PinCode_Covered']}"; } ?>
You forgot the two % signs.
------
The code in which i used the query as follows
-----
<?
$Pin_Code = '110065';
$result=mysql_query("SELECT * FROM tablename where PinCode_Covered LIKE '$Pin_Code'");
$num=mysql_num_rows($result);
while($row = mysql_fetch_array($resultbb, MYSQL_ASSOC))
{
$PinCode_Covered=$row['PinCode_Covered'];
echo "{$row['PinCode_Covered']}"; } ?>
You have not given '%' for the variable $Pin_Code
Try the below code: -
<?
-
$Pin_Code = '%110065%';
-
$result=mysql_query("SELECT * FROM tablename where PinCode_Covered LIKE '$Pin_Code'");
-
$num=mysql_num_rows($result);
-
-
while($row = mysql_fetch_array($resultbb, MYSQL_ASSOC))
-
{
-
$PinCode_Covered=$row['PinCode_Covered'];
-
echo "{$row['PinCode_Covered']}"; } ?>
Amit and Praveen:
Please use CODE tags when posting source code:
[CODE=php]
PHP code goes here.
[/CODE]
Amit, this is *not* the first time you've been asked. Don't make me issue a formal warning.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: lenny |
last post by:
Hi,
I've been trying to use a Sub or Function in VBA to connect to a
database, make a query and return the recordset that results from the
query. The connection to the database and the query...
|
by: Andy_Khosravi |
last post by:
I have been trying to build a user friendly search engine for a small
database I have created. I'm having some particular problems with one
of my date fields.
Here's the setup:
I'm using...
|
by: Carramba |
last post by:
hi!
Iam trying to make program were I enter string and serach char.
and funktion prints out witch position char is found this
is done if funktion serach_char. so far all good
what I want do...
|
by: Carramba |
last post by:
hi!
the code is cinpiling with gcc -ansi -pedantic. so Iam back to my question
Iam trying to make program were I enter string and serach char.
and funktion prints out witch position char is...
|
by: Dinesh Jain |
last post by:
Hi all,
I am dealing with a serious problem with an application which
displays texts of all the labels perfectly under
the setting 96 DPI (from control panel) but doesn't displays labels...
|
by: Development - multi.art.studio |
last post by:
Hello everyone,
i just upgraded my old postgres-database from version 7.1 to 7.4.2.
i dumped out my 7.1 database (with pg_dump from 7.1) as an sql-file with
copy-commands and to one file using...
|
by: HC |
last post by:
Hello, all, I started out thinking my problems were elsewhere but as I
have worked through this I have isolated my problem, currently, as a
difference between MSDE and SQL Express 2005 (I'll just...
|
by: raknin |
last post by:
Hi,
Is there any way using mysql to serach a values in a string where I don't care what is in between, for example:
I have a row which contains the following string in the foloowing format
...
|
by: lakshmiRam |
last post by:
hi i have a bluetooth dongle and a program to serach all the devices using bluetooth,
but the problem is findFirstDevice() function always returns null so it fails in searching but, i know that...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
| |