0

/t5/dreamweaver-discussions/hi-using-php-but-having-problem-with-search-results/td-p/70266
Jul 14, 2007
Jul 14, 2007
Copy link to clipboard
Copied
Hi my search results are working except for a very important
part of only showing those that are active, set by admin.
It is showing results event if they are inactive.
My default in mysql is set to inactive and in edit I change to active.
This is what my search is:
It is showing results event if they are inactive.
My default in mysql is set to inactive and in edit I change to active.
This is what my search is:
TOPICS
Server side applications
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
LEGEND
,
Jul 14, 2007
Jul 14, 2007
jjjhbj111 wrote:
> Hi my search results are working except for a very important part of only
> showing those that are active, set by admin.
> It is showing results event if they are inactive.
Rewrite the WHERE clause like this:
WHERE listingf.status = 'active' AND
(listingf.classbusinessname LIKE '%SearchString%'
OR listingf.inv_addr1 LIKE '%SearchString%'
OR listingf.classcatid LIKE '%SearchString%'
OR listingf.categorytype LIKE '%SearchString%'
OR listingf.inv_state LIKE '%SearchString%'
OR...
> Hi my search results are working except for a very important part of only
> showing those that are active, set by admin.
> It is showing results event if they are inactive.
Rewrite the WHERE clause like this:
WHERE listingf.status = 'active' AND
(listingf.classbusinessname LIKE '%SearchString%'
OR listingf.inv_addr1 LIKE '%SearchString%'
OR listingf.classcatid LIKE '%SearchString%'
OR listingf.categorytype LIKE '%SearchString%'
OR listingf.inv_state LIKE '%SearchString%'
OR...
LEGEND
,
/t5/dreamweaver-discussions/hi-using-php-but-having-problem-with-search-results/m-p/70267#M98540
Jul 14, 2007
Jul 14, 2007
Copy link to clipboard
Copied
jjjhbj111 wrote:
> Hi my search results are working except for a very important part of only
> showing those that are active, set by admin.
> It is showing results event if they are inactive.
Rewrite the WHERE clause like this:
WHERE listingf.status = 'active' AND
(listingf.classbusinessname LIKE '%SearchString%'
OR listingf.inv_addr1 LIKE '%SearchString%'
OR listingf.classcatid LIKE '%SearchString%'
OR listingf.categorytype LIKE '%SearchString%'
OR listingf.inv_state LIKE '%SearchString%'
OR listingf.inv_addr2 LIKE '%SearchString%'
OR listingf.tel LIKE '%SearchString%')
Notice that the section after AND is enclosed in parentheses.
--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
> Hi my search results are working except for a very important part of only
> showing those that are active, set by admin.
> It is showing results event if they are inactive.
Rewrite the WHERE clause like this:
WHERE listingf.status = 'active' AND
(listingf.classbusinessname LIKE '%SearchString%'
OR listingf.inv_addr1 LIKE '%SearchString%'
OR listingf.classcatid LIKE '%SearchString%'
OR listingf.categorytype LIKE '%SearchString%'
OR listingf.inv_state LIKE '%SearchString%'
OR listingf.inv_addr2 LIKE '%SearchString%'
OR listingf.tel LIKE '%SearchString%')
Notice that the section after AND is enclosed in parentheses.
--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/dreamweaver-discussions/hi-using-php-but-having-problem-with-search-results/m-p/70268#M98541
Jul 14, 2007
Jul 14, 2007
Copy link to clipboard
Copied
Thank you so much David, you are sooo cool!
Switching around sometimes I forget to try that. I was starting to think of really complex recordsets. Y ou have saved me writing a whole lot of gibberish.
I did have the parenthesis in the beginning when I was using an inner join but removed it when I thought I didn't need it.
Something more to learn about.
Thanks again!!
Switching around sometimes I forget to try that. I was starting to think of really complex recordsets. Y ou have saved me writing a whole lot of gibberish.
I did have the parenthesis in the beginning when I was using an inner join but removed it when I thought I didn't need it.
Something more to learn about.
Thanks again!!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/dreamweaver-discussions/hi-using-php-but-having-problem-with-search-results/m-p/70269#M98542
Jul 15, 2007
Jul 15, 2007
Copy link to clipboard
Copied
jjjhbj111 wrote:
> Thank you so much David, you are sooo cool!
> Switching around sometimes I forget to try that. I was starting to think of
> really complex recordsets.
Glad to have sorted it so quickly. Sometimes, the simple solution is all
you need, but it often takes another pair of eyes to spot it.
--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
> Thank you so much David, you are sooo cool!
> Switching around sometimes I forget to try that. I was starting to think of
> really complex recordsets.
Glad to have sorted it so quickly. Sometimes, the simple solution is all
you need, but it often takes another pair of eyes to spot it.
--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/dreamweaver-discussions/hi-using-php-but-having-problem-with-search-results/m-p/70270#M98543
Jul 27, 2007
Jul 27, 2007
Copy link to clipboard
Copied
Hi just a quick question even though this is solved.
With the results page I am wanting to show the actual name instead of the foreign key.
What I mean is the inv_state is a foreign key but I am wanting to show the inv_statename.
I am wondering your thoughts as to keep the query the same include the inv_state table.
Thanks very much for your advice here it has been great...
With the results page I am wanting to show the actual name instead of the foreign key.
What I mean is the inv_state is a foreign key but I am wanting to show the inv_statename.
I am wondering your thoughts as to keep the query the same include the inv_state table.
Thanks very much for your advice here it has been great...
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/dreamweaver-discussions/hi-using-php-but-having-problem-with-search-results/m-p/70271#M98544
Jul 27, 2007
Jul 27, 2007
Copy link to clipboard
Copied
jjjhbj111 wrote:
> What I mean is the inv_state is a foreign key but I am wanting to show the
> inv_statename.
To do that, you need to list all the columns that you want to retrieve
instead of using *. Then add inv_statename and the the name of the table
that it resides in.
--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
> What I mean is the inv_state is a foreign key but I am wanting to show the
> inv_statename.
To do that, you need to list all the columns that you want to retrieve
instead of using *. Then add inv_statename and the the name of the table
that it resides in.
--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/dreamweaver-discussions/hi-using-php-but-having-problem-with-search-results/m-p/70272#M98545
Jul 27, 2007
Jul 27, 2007
Copy link to clipboard
Copied
thanks I thought so...
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

