close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Results page show image, "print" searched term

Thread began 1/10/2013 12:15 pm by jo271221 | Last modified 2/12/2013 10:26 am by Jason Byrnes | 2710 views | 9 replies |

jo271221

Results page show image, "print" searched term

I want to print the year searched for on the page - directory-and-posts-horse-ads.php?id=6246&horse_year_foaled=2010&Search=Search

This should say 2 of 2 2010 Horses For Sale

I want to display the image from the post table on this page On the test copy ads_horses_results.php
I copied the recordset from the post page but then realized I have no idea why the join statement on this page does not allow me to bind to any or all fields in the post table without adding another recordset and have no idea the correct way to get the images on this page.

Attached Files
ads_horses_results.zip
Sign in to reply to this post

Jason ByrnesWebAssist

the year is returned in a URL variable:
&horse_year_foaled=2010

to write the URL variable value to the page, use:

php:
<?php echo(isset($_GET['horse_year_foaled'])?$_GET['horse_year_foaled']:""); ?>



in the WADAtbl_post recordset, you need to include the tbl_posts table in the select statement:
SELECT ads_horses.*,tbl_posts.* FROM ads_horses INNER JOIN tbl_posts ON ads_horses.adid = tbl_posts.postid ORDER BY adid DESC

Sign in to reply to this post

jo271221

Join Statemetn to show image

The print work great! Thank you!

The Column 'adid' in order clause is ambiguous - I have zipped my attempts and here are the live pages:
ads_horses_results-ORDERBYadid.php

My most recent attempt show one horse repeating - ie only the 1st matching horse in the database I assume.
ads_horses_results.php

On this file I added a filter to just display ads with images
"SELECT ads_horses.*,tbl_posts.* FROM ads_horses INNER JOIN tbl_posts ON ads_horses.adid = tbl_posts.postid WHERE ad_category = '3' AND image IS NOT NULL AND image <> '' ORDER BY postid DESC"; so we could see just ads which have images and also ad_category is the id for the ads_horses

I also added this and the price and customer ID does not display, looks like nothing from the tbl_posts is displaying.
Customer ID: {WADAads_horses.customerid} ${WADAtbl_post.price}

I thought I had this working right away by simply changing the ORDER BY to postid, nearly sure I did. Therefore I tried again with
"SELECT ads_horses.*,tbl_posts.* FROM ads_horses INNER JOIN tbl_posts ON ads_horses.adid = tbl_posts.ad_category ORDER BY postid DESC"; Because the ad_category is the field that actual is common between the 2 tables, but here the image does not show up at all. Nor does the price or customer id

ads_horses_results.php

The FTP info is in message 8 on closed ticket #146365

Thank You!

Attached Files
ads_horses_results-ORDERBYadid.zip
Sign in to reply to this post

Jason ByrnesWebAssist

change:
ORDER BY adid DESC";


to:
ORDER BY ads_horses.adid DESC";



also, in the Data Assist search code block for each of the comparisons:

php:
//comparison list additions

  $WADbSearch1->addComparisonFromEdit("adid","adid","AND","=",1);
  $WADbSearch1->addComparisonFromEdit("horse_name","horse_name","AND","Includes",0);
  $WADbSearch1->addComparisonFromEdit("horse_barn_name","horse_barn_name","AND","Includes",0);
  $WADbSearch1->addComparisonFromEdit("horse_breed_id","horse_breed_id","AND","Includes",0);
  $WADbSearch1->addComparisonFromEdit("horse_reg_yn","horse_reg_yn","AND","Includes",0);
  $WADbSearch1->addComparisonFromEdit("horse_reg_assn","horse_reg_assn","AND","Includes",0);
  $WADbSearch1->addComparisonFromEdit("horse_reg_number","horse_reg_number","AND","Includes",0);
  $WADbSearch1->addComparisonFromEdit("customerid","customerid","AND","=",1);
  $WADbSearch1->addComparisonFromEdit("fldstate","state","AND","=",0);
  $WADbSearch1->addComparisonFromEdit("horse_month_foaled","horse_month_foaled","AND","=",0);
  $WADbSearch1->addComparisonFromEdit("horse_year_foaled","horse_year_foaled","AND","=",0);
  $WADbSearch1->addComparisonFromEdit("horse_gender","horse_gender","AND","=",0);
  $WADbSearch1->addComparisonFromEdit("horse_in_foal_yn","horse_in_foal_yn","AND","Includes",0);
  $WADbSearch1->addComparisonFromEdit("horse_color","horse_color","AND","=",0);
  $WADbSearch1->addComparisonFromEdit("horse_hands_high","horse_hands_high","AND","Includes",0);
  $WADbSearch1->addComparisonFromEdit("horse_skill_id","horse_skill_id","AND","Includes",0);
  $WADbSearch1->addComparisonFromEdit("sire","sire","AND","=",0);
  $WADbSearch1->addComparisonFromEdit("siressire","siressire","AND","=",0);
  $WADbSearch1->addComparisonFromEdit("dam","dam","AND","=",0);
  $WADbSearch1->addComparisonFromEdit("damssire","damssire","AND","=",0);




if it rtefernaces a column that is in both tables, you will need to edit the code to specofy which table to look in, for example:

php:
$WADbSearch1->addComparisonFromEdit("adid","adid","AND","=",1);




would need to be changed to:

php:
$WADbSearch1->addComparisonFromEdit("ads_horses.adid","adid","AND","=",1);
Sign in to reply to this post

jo271221

Still no image in joined table classified ads

I am sorry, my image is still not appearing - I have the image file name as
<img src="<?php echo $row_WADAads_horses['image']; ?>
ads_horses_results.php
No image appears

ads_horses_results1.php
<img src="<?php echo $row_WADAtbl_post["image"]; ?>
the same image recurs here
I tried adding this as well
$WADbSearch1->addComparisonFromEdit("ads_horses.adid","image","AND","=",1);
and that did not work
and
$WADbSearch1->addComparisonFromEdit("ads_horses.adid","image","AND","=",1);
so I removed that. The only commen field is that ads_horses.adid and tbl_posts.postid

1. What is the correct image name?
2. Does the 2nd recordset ORDER BY tbl_posts.postid
3. Does the 1st ads_horses recordset order by ORDER BY ads_horses.adid DESC";

What am I doing wrong?

Attached Files
ads_horses_results1.zip
Sign in to reply to this post

Jason ByrnesWebAssist

the select statement for the WADAads_horses recordset needs to refer to both tables.

instead of:
SELECT ads_horses.* FROM ads_horses INNER JOIN tbl_posts ON ads_horses.adid = tbl_posts.postid.....


it should be:
SELECT ads_horses.*,tbl_posts.* FROM ads_horses INNER JOIN tbl_posts ON ads_horses.adid = tbl_posts.postid.....



you don't need the WADAtbl_post recordset on the page, wherever you are trying to use the WADAtbl_post recordset, you should use the WADAads_horses recordset instead.

Sign in to reply to this post

jo271221

Another print search results

I tried using the same scenario on this page - ads-events-news.php?SI=&Search=1 (bottom of the page) and I tried post and get and neither works for me.

<?php echo(isset($_POST['keywordfilter'])?$_POST['keywordfilter']:""); ?>&nbsp; <?php echo(isset($_GET['news_type'])?$_GET['news_type']:""); ?>&nbsp;<?php echo(isset($_GET['event_type'])?$_GET['event_type']:""); ?>&nbsp;<?php echo(isset($_GET['adssoldsign'])?$_GET['adssoldsign']:""); ?>

Attached Files
ads-events-newsFW.zip
Sign in to reply to this post

Jason ByrnesWebAssist

i dont follow, what is it you are trying to do on this page?

please be as detailed as possible. just saying it doesn't work does not give enough information for me to know what the desired result.

a description of what you are trying to accomplish and how the output on the page differs from what you are trying to accomplish will help me understand what the problem is.

Sign in to reply to this post

jo271221

printing search results to display on page

I would like to "print" what is being searched on this page: ads-events-news.php ie if I searched for caption=country I would expect to print something similar that displays on the page so the user can see what they searched for and it displays on the page, When a new topic is searched the new topic displays.
On this page we have it printing directory-and-posts-horse-ads.php?id=6246&horse_year_foaled=2010&Search=Search

1 to 3 of 2010 Horses for Sale

Sign in to reply to this post

Jason ByrnesWebAssist

your form uses the get method.

in this code:
<?php echo(isset($_POST['keywordfilter'])?$_POST['keywordfilter']:""); ?>

you referencing a form element from the post method.

it should be:
<?php echo(isset($_GET['keywordfilter'])?$_GET['keywordfilter']:""); ?>

your form includes the following fields:
caption, keywordfilter, companyname, contactfirstname, contactlastname, city, fldstate, interestid


you will need an echo statement for each one.

Sign in to reply to this post
loading

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...