close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Search related to results

Thread began 2/08/2013 2:23 pm by keegan431775 | Last modified 2/08/2013 3:00 pm by Jason Byrnes | 406 views | 3 replies |

keegan431775

Search related to results

Hi.

I have a table of people and a table of relation. The relation table has people_id, relation_id, related_people_id.

The relation table tells me who is related to who "people_id" is related to "related_people_id" and how they are related, defined by "relation_id".

The search currently shows me people who have the relation_id that matches my selection.

I'd like to search by all this criteria and then show people related to the results. Ex: search for every person with the relation_id of mom of a person 13-18yrs old.

Any ideas? I'd appreciate the help.

Recordset:

mysql_select_db($database_MinistryPro, $MinistryPro);
$query_rs_people = "SELECT people.people_id, people.people_status, people.people_profilepic, people.people_first_n, people.people_last_n, people.people_gender, people.people_birthdate, people.people_grade, people.people_address, people.people_address_2, people.people_city, people.people_state, people.people_zip, people.people_phone_number, people.people_phone_number_alt_1, people.people_phone_number_alt_2, people.people_txt_provider_id, people.people_txt_on_off, people.people_email, people.people_email_alt_1, people.people_email_alt_2, people_tag.tag_id, tag.tag_title, people_step.people_step_id, people_step.step_id, people_place.place_id, place.place_title, people_relation.people_relation_id, people_relation.relation_id, people_relation.related_people_id
FROM people
LEFT JOIN people_tag ON (people.people_id = people_tag.people_id)
LEFT JOIN tag ON (people_tag.tag_id = tag.tag_id)
LEFT JOIN people_place ON (people.people_id = people_place.people_id)
LEFT JOIN place ON (people_place.place_id = place.place_id)
LEFT JOIN people_step ON (people.people_id = people_step.people_id)
LEFT JOIN people_relation ON (people.people_id = people_relation.related_people_id)
LEFT JOIN relation ON (people_relation.relation_id = relation.relation_id)
GROUP BY people.people_id, people_tag.people_id, people_step.people_id, people_place.people_id";
setQueryBuilderSource($query_rs_people,$WADbSearch1,false);
$rs_people = mysql_query($query_rs_people, $MinistryPro) or die(mysql_error());
$row_rs_people = mysql_fetch_assoc($rs_people);
$totalRows_rs_people = mysql_num_rows($rs_people);

Comparison list:

//comparison list additions
$WADbSearch1->addComparison("people_first_n","".((isset($_POST["first_name"]))?$_POST["first_name"]:"") ."","AND","Includes",0);
$WADbSearch1->addComparison("people_last_n","".((isset($_POST["last_name"]))?$_POST["last_name"]:"") ."","AND","Includes",0);
$WADbSearch1->addComparison("people_gender","".((isset($_POST["button-radio"]))?$_POST["button-radio"]:"") ."","AND","=",0);
$WADbSearch1->addComparisonFromList("people_marital_status","marital_status","AND","=",0);
$WADbSearch1->addComparison("people_birthdate","".$min_birthdate ."","AND","<=",2);
$WADbSearch1->addComparison("people_birthdate","".$max_birthdate ."","AND",">=",2);
$WADbSearch1->addComparison("people_address","".((isset($_POST["address"]))?$_POST["address"]:"") ."","AND","Includes",0);
$WADbSearch1->addComparison("people_address_2","".((isset($_POST["address_2"]))?$_POST["address_2"]:"") ."","AND","Includes",0);
$WADbSearch1->addComparison("people_city","".((isset($_POST["city"]))?$_POST["city"]:"") ."","AND","Includes",0);
$WADbSearch1->addComparison("people_state","".((isset($_POST["state"]))?$_POST["state"]:"") ."","AND","=",0);
$WADbSearch1->addComparison("people_zip","".((isset($_POST["zip"]))?$_POST["zip"]:"") ."","AND","=",1);
$WADbSearch1->addComparison("people_phone_number","".((isset($_POST["area_code"]))?$_POST["area_code"]:"") ."".((isset($_POST["phone_number"]))?$_POST["phone_number"]:"") ."","AND","Includes",0);
$WADbSearch1->addComparison("people_email","".((isset($_POST["email"]))?$_POST["email"]:"") ."","AND","Includes",0);
$WADbSearch1->addComparison("people_grade","".((isset($_POST["grade_min"]))?$_POST["grade_min"]:"") ."","AND","<=",2);
$WADbSearch1->addComparison("people_grade","".((isset($_POST["grade_max"]))?$_POST["grade_max"]:"") ."","AND",">=",2);
$WADbSearch1->addComparisonFromList("people_place.place_id","place","AND","=",0);
$WADbSearch1->addComparisonFromList("people_tag.tag_id","tags","AND","=",0);
$WADbSearch1->addComparisonFromList("people_status","status","AND","=",0);
$WADbSearch1->addComparison("step_id","".$steps_array ."","AND","=",0);
$WADbSearch1->addComparisonFromList("people_relation.relation_id","relation","AND","=",0);

Sign in to reply to this post

Jason ByrnesWebAssist

ok, so what specifically is not working with your current set up?

i need some more details on how the search is currently functioning versus how you expect it to function.

a link where i can see the problem, example search criteria to test and the expected results versus what is happening for that search would be a big help.

also, it would help to see the SQL For the search on the results page.

in the body of the results page add the following code to echo the SQL being generated:

php:
<?php echo("SQL: ".$query_rs_people."<br />"); ?>
Sign in to reply to this post

keegan431775

It's showing me a list of people who have the relation mom attached to them. When I want to see the list of people who are "moms" of the list it is showing me.

I want to search the "people" information by all these criteria, but then return the "related" people of those people.

I've got private info on this database, so I can't share a link. But here is the SQL :

SQL: SELECT people.people_id, people.people_status, people.people_profilepic, people.people_first_n, people.people_last_n, people.people_gender, people.people_birthdate, people.people_grade, people.people_address, people.people_address_2, people.people_city, people.people_state, people.people_zip, people.people_phone_number, people.people_phone_number_alt_1, people.people_phone_number_alt_2, people.people_txt_provider_id, people.people_txt_on_off, people.people_email, people.people_email_alt_1, people.people_email_alt_2, people_tag.tag_id, tag.tag_title, people_step.people_step_id, people_step.step_id, people_place.place_id, place.place_title, people_relation.people_relation_id, people_relation.relation_id, people_relation.related_people_id FROM people LEFT JOIN people_tag ON (people.people_id = people_tag.people_id) LEFT JOIN tag ON (people_tag.tag_id = tag.tag_id) LEFT JOIN people_place ON (people.people_id = people_place.people_id) LEFT JOIN place ON (people_place.place_id = place.place_id) LEFT JOIN people_step ON (people.people_id = people_step.people_id) LEFT JOIN people_relation ON (people.people_id = people_relation.related_people_id) LEFT JOIN relation ON (people_relation.relation_id = relation.relation_id) WHERE (people_first_n LIKE '%Keegan%') AND (people_birthdate <= "2013-02-08 00:00:00") AND (people_birthdate >= "1912-02-08 00:00:00") AND ((people_relation.relation_id = '2')) GROUP BY people.people_id, people_tag.people_id, people_step.people_id, people_place.people_id

Hope that helps.
Thanks.
Keegan

Sign in to reply to this post

Jason ByrnesWebAssist

I'm not understanding something about what you are trying to accomplish.
I have created a support ticket so we can look into this issue further.

To view and edit your support ticket, please log into your support history:
supporthistory.php

If anyone else is experiencing this same issue, please append to this thread.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...