473,399 Members | 3,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Search within a search within a search

I'm having some trouble with the search field that i am setting up
using PHP and HTML, I am connecting to a database to return proper
information pertaining to something being searched. I originally set
up a search to work like this :

$SQL = "
select id,
name
from repository
where upper(name) like upper('%$search%')
";
$Result=SubmitQuery($db,$SQL);
while (OCIFetch($Result)) {
$repo_id = OCIResult($Result,"ID");
$name = OCIResult($Result,"NAME");
echo"

and display the results accordingly, This was one teer of the
searching, the database would then search modules and files just as
seen above, but I ran into the problem where the correct values are not
being passed, so it was searching all repositories, then all modules,
then all files.... is it possible to search like this:

Repository #1
---Module #1 in Repo#1
------files in Module #1
---Module #2 in Repo #1
------files in Module #2 Repo #1
etc.\
\\
\\
\\
Repository #2
--Module #1 in Repo #2
etc......

is this possible to do a search under a search under a search with SQL
PHP?????

Jan 25 '06 #1
1 1515
Rachelle wrote:
<snip>
is it possible to search like this:

Repository #1
---Module #1 in Repo#1
------files in Module #1
---Module #2 in Repo #1
------files in Module #2 Repo #1
etc.\
\\
\\
\\
Repository #2
--Module #1 in Repo #2
etc......

is this possible to do a search under a search under a search with SQL
PHP?????


SELECT not tested:

select <fields>
from repository r
join module m on r.rep_id = m.rep_id
join file f on m.mod_id = f.mod_id
where <conditions>
order by <whatever>
limit <something>

With this you'll get something like

rep_id | rep_name | mod_id | mod_name | file_id | file_name | ...
-------+----------+--------+----------+---------+-----------+----
1 | master | 1 | test | 1 | test.php | ...
1 | master | 1 | test | 2 | echo.php | ...
1 | master | 2 | environ | 3 | data.php | ...
2 | slave | 3 | listen | 4 | open.php | ...
....

Then use PHP to format the data however you like best :-)
Maybe putting it all in an array first will make it easier to format as
you need.

--
If you're posting through Google read <http://cfaj.freeshell.org/google>
Jan 25 '06 #2

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

Similar topics

3
by: Andy Jacobs | last post by:
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; ?> The search function goes through the table and...
39
by: Noticedtrends | last post by:
Can inference search-engines narrow-down the number of often irrelevant results, by using specific keywords; for the purpose of discerning emerging social & business trends? For example, if...
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...
7
by: John | last post by:
hi, i have created a search form, and i want to search for a specific item in a field. e.g. i have a field called colour, which has record1 = 'red, blue, green' and another record2 = 'red' ...
5
by: justobservant | last post by:
When more than one keyword is typed into a search-query, most of the search-results displayed indicate specified keywords scattered throughout an entire website of content i.e., this is shown as...
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...
1
by: Lance Hoffmeyer | last post by:
Hey all, How do I add another index inside a re.search? I want to add for j in BASE = re.search ... sh.Cells97... for i ....
1
by: cglewis03 | last post by:
Hello, I am trying to build a search form with several different options to choose from. Currently it is set up to open within the same window if a single option is selected and open within a...
1
by: calhoun | last post by:
Hi All, sorry for the newbie question but how do I search within a Sub-Forum? I was in POSTGRESQL and there was an option to search within the forum. I tried to search 'system tables postgresql' but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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
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...

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.