close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

search problems after upgrade to mysql_i

Thread began 8/01/2019 11:35 am by Sweens | Last modified 8/05/2019 6:06 am by Ray Borduin | 37 views | 9 replies |

Sweens

search problems after upgrade to mysql_i

HI Ray

Just testing an upgraded search page from mysql to mysql_i and I just can't get it to work! I think I've tried all the variable of AND or OR, column types etc - but always get nothing.

I deleted the old WA Search and ran the new mysql_i one, but no joy.

Original and new (1-pages_Results4.php) attached.

Cheers
Chris

Sign in to reply to this post

Ray BorduinWebAssist

It looks like your mySQLi version has a different trigger. You have:

if (isset($_POST["Search"]) || isset($_POST["Search_x"])) {

it should be the same as the working page:

if (isset($_GET["Search"]) || isset($_GET["Search_x"])) {

Sign in to reply to this post

Sweens

Thanks Ray - tried that and now get

There is an error in your SQL syntax.

after doing the search. When running the search behaviour, it puts POST in by default.

Latest version attached.

Thanks again,

Chris

Sign in to reply to this post

Ray BorduinWebAssist

Update your rsobj.php file and find the line near the top that has debug = false; and change it to debug=true. That should give you more information about what the SQL error is, and may be enough to help you figure out what needs to be changed. Otherwise post the full error back here and I'll provide my insight.

Sign in to reply to this post

Sweens

Thanks Ray

I get:

SELECT `pages`.`PgID`, `pages`.`PgTypeID`,`pages`.`PgBriefDetails`,`pages`.`PgMainPic`, `pages`.`PgMainPicAltText`, pages.StartDate, pages.EndDate, DATE_FORMAT (pages.StartDate ,'%a %D %b %Y') AS `StartDateA`, DATE_FORMAT (pages.EndDate ,'%a %D %b %Y') AS `EndDateA`, `pages`.`Active`, `pages`.`PgSticky`, `pages`.`MemOnly`, `pages`.`PgTitle`, `pagetypes`.`PageType`, `p2a`.`PgTitle` AS `UnderPageTitle`, Count(distinct `sub-pages`.`PgID`) AS `SubPages`, Count(distinct comments.`CmID`) AS `comments`, `pages`.`Under_PgID`, CONCAT_WS (' ',rotarians.FirstName, rotarians.Surname) AS `Author`, CONCAT (LEFT (`rotarians` .`FirstName` ,1), LEFT(`rotarians` .`Surname` ,1)) AS `Authinitials`, Count(distinct`pageimages`.`PicID`) AS `Slideshow`, pages.MODisplay, pages.PgDesc, Count(distinct`pageforms`.`FormID`) AS FormID FROM `pages` Inner Join `pagetypes` ON `pagetypes`.`PgTypeID` = `pages`.`PgTypeID` Left Join `pages` AS `p2a` ON `pages`.`Under_PgID` = `p2a`.`PgID` Left Join `pages` AS `sub-pages` ON `sub-pages`.`Under_PgID` = `pages`.`PgID` Left Join `comments` ON `pages`.`PgID` = `comments`.`PgID` Left Join `rotarians` ON `pages`.`Pg_RotID` = `rotarians`.`RotID` Left Join `pageimages` ON `pages`.`PgID` = `pageimages`.`PgID` Left Join `pageforms` ON `pages`.`PgID` = `pageforms`.`PgID` WHERE (`pages`.`ClubID` = ?) AND `pages`.`DistrictNo` IS NULL AND ((`PgTypeID` = ?)) GROUP BY `pages`.`PgID` ORDER BY `pages`.`StartDate` ASC, `pages`.`PgID` DESC

Column 'PgTypeID' in where clause is ambiguous
-------------

However, PgTypeID isn't in my WHERE clause in my recirdset - is this altered by the search? If so, where would I specify pages.PgTypeID?

Would it be on this line - ?

$searchWADApage1->setSearch(array("type"=>"Edit", "comparison"=>"=", "join"=>"AND"), array("PgTypeID"), "d", "PgTypeID");

Thanks again for your help.

Chris

Sign in to reply to this post

Ray BorduinWebAssist

You are doing a search against the PgTypeID column, but that column exists in two tables so it is asking you to be more specific.

Update this part:
array("PgTypeID"),

To:
array("TableName.PgTypeID"),

Where TableName is the table you want the search to look at that column value in. That should fix the problem.

Sign in to reply to this post

Sweens

Brilliant! Thanks so much for your patience and perseverance, Ray.

Cheers
Chris S

Sign in to reply to this post

Sweens

Sorry to pester you - everything works except for the text field searches, PgTitle and PgBriefDetails.

I have the following lines, but the text from the form returns 'not found', even though I know the words are there.

$searchWADApage1->setSearch(array("type"=>"Key", "comparison"=>"=", "join"=>"AND", "and"=>", ", "or"=>" ", "start_encap"=>"\"", "end_encap"=>"\""), array("pages.PgTitle"), "s", "".((isset($_GET["PgTitle"]))?$_GET["PgTitle"]:"") ."");
$searchWADApage1->setSearch(array("type"=>"Key", "comparison"=>"=", "join"=>"AND", "and"=>", ", "or"=>" ", "start_encap"=>"\"", "end_encap"=>"\""), array("pages.PgBriefDetails"), "s", "".((isset($_GET["PgBriefDetails"]))?$_GET["PgBriefDetails"]:"") ."");

Thanks
Chris

Sign in to reply to this post

Ray BorduinWebAssist

You have "comparison"=>"="

try:
"comparison"=>"includes"

Sign in to reply to this post

Sweens

Ignore that - I reran the setup and things work now.

Thanks again

Chris

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