473,769 Members | 4,470 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display Results within results - PHP & MySQL

18 New Member
Hello all, I am fairly new to php etc, and I have a database

1) I have already did a search for: "Results within results" on this site, in PHP & MySQL forums ( I think) properly...and one search resulted in over 100 pages etc.

From the below structure of my DB, I would like to get the code from the below URL working on my existing data I have, but I am having trouble and I am just getting flustered....

I would eventually like to have the user "select" first a $State and then $County from a "drop down" for now, and eventually a "map" but the "drop down" for these (2) will be a must have....but I am just trying to use this function first.

At present, I am unable to even get proper printed results, and I know it has to do with something on the variable call end that is screwing me up.

2) This is what I am using (learning) from:

http://hudzilla.org/phpwiki/index.ph...within_results

3) This is my mySQL db structure:
Expand|Select|Wrap|Line Numbers
  1. mysql> desc skylos;
  2. +---------------+------------------+------+-----+---------+----------------+
  3. | Field         | Type             | Null | Key | Default | Extra          |
  4. +---------------+------------------+------+-----+---------+----------------+
  5. | id            | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
  6. | Type          | text             | NO   |     | NULL    |                |
  7. | Name          | text             | NO   |     | NULL    |                |
  8. | Address       | text             | NO   |     | NULL    |                |
  9. | City          | text             | NO   |     | NULL    |                |
  10. | County        | text             | NO   |     | NULL    |                |
  11. | State         | text             | NO   |     | NULL    |                |
  12. | Zip           | text             | NO   |     | NULL    |                |
  13. | Phone         | text             | NO   |     | NULL    |                |
  14. | Email_Exists  | text             | NO   |     | NULL    |                |
  15. | Email_Address | text             | NO   |     | NULL    |                |
  16. | Website       | text             | NO   |     | NULL    |                |
  17. +---------------+------------------+------+-----+---------+----------------+
  18. 12 rows in set (0.00 sec)
  19.  
4) I am also referencing the extract() function here:
http://php.net/manual/en/function.extract.php

5) Here is the code I presently am playing with, as I want to for now just print out Phone, Name Address for now to get my feet wet with this function call.

[PHP]
$result = mysql_query("SE LECT ID, Phone FROM skylos;");

// Already connected above

while ($row = mysql_fetch_ass oc($result)) {
extract($row, EXTR_PREFIX_ALL , "conf");
print "<B>Busines s answering at $conf_Phone:</B><br />";
$subresult = mysql_query("SE LECT ID, Phone FROM skylos WHERE Address = $conf_ID;");

while ($subrow = mysql_fetch_ass oc($subresult)) {
extract($subrow , EXTR_PREFIX_ALL , "Address");
print " $Address_Addres s<br />";
}

print "<br />";
}
?>
[/PHP]

Thx all in advance for any help.

jim
Oct 20 '08 #1
2 3982
Atli
5,058 Recognized Expert Expert
Hi.

Those queries don't really make sense to me. They are both basically the same, except you try to filter the second one by matching the "Address" field to the "ID" field of the current row from the first query (which doesn't really make sense either).

What is it exactly that you want this code to print?
Could you show us an example?
Oct 22 '08 #2
trochia
18 New Member
Atli, first of all I thank-you very much for the reply, and also again the "advanced search" search link you gave me. That will help a lot here on this site.

1) I am building a site to donate to the planet, as 9/12/08 my dog was stolen. (Sorry for this info, but it is a life priority for me now) and trying to build a collective site, as www.petfinder.c om is no longer really maintained for the past year, and there is no way to search/locate and narrow things down precisely

2) In my database, I presently have (2) tables but there will be 3 (at least) one to contain the above information which will be for Veterinarians, Kennels & Shelters. For now, this is what I am learning-practicing with.

For now, I would would like the user come to a page, and first select from a populated drop-down or radio button (or for now) just enter $State 2 letter abbreviation ( here, they will be able to select only 1 ) of where they are located in.

I will then "pull to display" $County (in which they live in, and also surrounding areas - so this could be multpile radio/drop-down), but here on this page it will ask if you are a :

BUYER ( I have lost, found or missing a pet)

SUPPLIER ( A Vet Hospital, Kennel or Animal Shelter will be located in only (1) physical location established. )

Once this question is answered, we branch off like this:

Buyer = User who has either LOST or FOUND a Pet (flagged in table) and they will be able to select multiple $County to search/post in. (locations), hence the my post topic of: "Display Results within results" to be able to then pull "listings" of either:

$lost OR $found as it stands now, and this will display for them.

$lost = Multiple radio for $County, City for $search

If they have $found they will then be moved to a page for database entry:

$enter > $found >$pet_type > $date

Supplier = This will be used two-fold. $search + $enter (to above table in example)

a: Buyer(user) selects $State, $County and depending on $Search will display one of the following

$vet
$shelter
$kennel

This is then used (displayed) for use for them (BUYER) to Contact (SUPPLIER) via $supplier [data]

Sorry if this is too much information, but this is the flow.

Thx again!! And I am enjoying this site.

Jim
Oct 22 '08 #3

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

Similar topics

7
3365
by: AF | last post by:
I am a real novice to php and MySQL, with about a week's worth of reading and self tutoring. I have an urgent need to publish a database of information and need some guidance on how to do this. This question might be more suited to a MySQL newsgroup, but since php and MySQL seem to have become almost married to one another, and since getting the data out and displaying it is where my problem seems to lie, I thought I would start with...
2
9917
by: Gnurp Gnarp | last post by:
When the number of columns get large, it becomes increasingly difficult to view the results of a select in a small window (e.g. 80 line xterm) because of line wrapping. Can I have the results of the select query displayed rotated, e.g. like this: +------+------+------+------+ | | row0 | row1 | row2 | +------+------+------+------+ | col0 | 0 | 3 | 6 | | col1 | 1 | 4 | 7 |
1
3021
by: SC | last post by:
I'm developing a site that may eventually have a very large database of users (hopefully, but who knows). It will be a community website where users can search each other (think Friendster, Classmates, every dating site out there, etc.). Often there will be queries with multiple joins and sometimes may include a few fulltext searches. Each page of results will have a limited number of results displayed (obviously). As I understand it,...
2
4360
by: ameshkin | last post by:
I know this is probably not too hard to do, but how do I display multiple rows of a mysql query/recordset. Im having trouble doing this. I don't just want to display them, but I want to make sure ONE field in each row gets a variable. The table name is RecentUploads, the field I want to pull is XML This is probably something simple that is more experienced, but I've only been doing this for a couple of months. Any help would be...
10
2453
by: universalbitmapper | last post by:
Hi, I'm trying a simple form.html that call a .html script that begins with: <?php header("This is a test"); ?> When I click on the link, I get blank page.
0
2219
by: taras.di | last post by:
Hi everyone, I've come across an extremely strange problem. The exact same query in both mysql command line client, and mysql query browser gives entirely different results. I was hoping someone out there could shed some light. Ok, the query (I've stripped it bare, the real query is a bit more complex)...
2
7053
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs, input box for units of service, description of the service and each row has its own dropdown list of unit fees that apply. Each dynamically created row will return 3 values fee1_choice, fee1_unit and fee1_money. Note The above informaton is...
2
3267
by: wreed06 | last post by:
Hello, I have 2 problems. In my webpage, I have a dropdown list with a button that takes the user to a popup window specific to the option. I am using Firefox 2.0.0.13. I have successfully validated my HTML and CSS code. 1. When I clear cache and refresh my webpage, it takes 3 tries before the popup window displays - I click on the button once, a white window the size of my webpage displays. I close it and click on the button again (for...
8
5573
by: The KwikOne | last post by:
Since to have a page validate (HTML and XHTML) you should have your URL parameters separated by the appropriate separator. However, if an ampersand is used it needs to be expressed as &amp; (example: ./ index.php?a=1&amp;B=2). But, if that is done, then the _GET or _REQUEST array element names are incorrect. In the example the _GET array will be: _GET = 1 (instead of _GET = 1) and _GET = 2 (instead of _GET = 2). So, how do I get around this?...
0
9591
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10225
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10001
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9867
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8880
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5312
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.