473,466 Members | 1,364 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How To fetch a data from the table?

irfanmodan
20 New Member
Hello everyone, I need Help...
table name=test
Expand|Select|Wrap|Line Numbers
  1. Nid(PK)|    DID   | Parentid
  2. 1      |    2,3   |    2
  3. 2      |    4,5,6 |    3 
  4. 3      |    NULL  |   5
How to fetch parent id thru did=5 or did=6 in php.... please reply me asap...
its urgent

Thanks In Advance
Jan 20 '11 #1
3 1337
Dormilich
8,658 Recognized Expert Moderator Expert
just to make clear, in your example the Parentid would be 3?
Jan 20 '11 #2
irfanmodan
20 New Member
ya...parent id is 3..
in this table did and parent id both are documentid from other table which is pk of that table..
means
other table like document
documentid
1
2
3
4
5 etc

i want to create sub menu so i used
nid(pk) did and parentid
table name like navigation

Nid(PK)| DID | Parentid
1 | 1,7 | 2
2 | 4,5,6 | 3
3 | NULL | 5

i used below query ...
SELECT did,parentid FROM navigation where did like '%5%'

here problem is two raw are fetch...but i want only one row which is documentid=4 or 5 or 6....please help me what can i do...
thanks in advance
Jan 22 '11 #3
Dormilich
8,658 Recognized Expert Moderator Expert
the easiest way to limit the result is to LIMIT.
Expand|Select|Wrap|Line Numbers
  1. SELECT did,parentid FROM navigation WHERE did LIKE '%5%' LIMIT 1
although I don’t see where 2 rows should come from in your shown table.
Jan 22 '11 #4

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

Similar topics

11
by: saurabhbpl | last post by:
hi, i have a html drop down menus and i want to conver it into dynamically means that menu show data from database.how can i fetch data from database for using menus and sub menus using php and...
2
by: hazelnut2705 | last post by:
Hi there.. how to fetch data from database and then display in title bar? <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo...
3
by: dmshah01in | last post by:
hi. i am new to .net i need to fetch data from excel sheet and display it on web page. please help me how to do this???
3
by: anirban | last post by:
I am a novice of VB I want to fetch data from combo box or list which is selected give me a easy way to select the data of combo box or list box I can show data in combo box or list box
3
by: aviansh | last post by:
Hi Experts, I am using sql server 2005. I have two database in same server i.e. DB1 and DB2. DB1 contains table1 and DB2 contains table2. i have to run a sql query in DB2 to fetch data from...
1
by: ravisuguna | last post by:
Hi, I have two tables in database .They have one field in common. I want to fetch data from both the tables through a single query.How could this be done?Pl help me Thanks in advance
0
by: ankitmathur | last post by:
Hi I'm using the following query to connect to my MSSQL 2000 DB1 and further use a linked server to connect and fetch data from DB2 there to get the data finally into DB3. Example IPs DB1:...
1
by: rahullko05 | last post by:
Hi, i am building a small forum site as my final year project & stuck in a very trivial problem. I have a table which are varchar type of data & i am trying to fetch data from table based on...
3
by: bharathk27 | last post by:
i have an datetimepicker and combobox in my winform. i have to fetch data in combobox according to date selected in date time picker.. i wrote this code in combobox, but it dosen't work. ...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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
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
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.