Jump to content

Error: Exception: SQLSTATE[42S22] with search.php


ocr_a
 Share

Recommended Posts

Hi all,

i been trying some things with a customized search form and suddenly it throws an SQLSTATE error.

can somebody explain what i did wrong? it's the code from the site-classic template...

if i leave the selector empty i get all pages in result,

if i add any selector it returns this error.

Error: Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'DatabaseQuerySelect' in 'order clause' (in /kunden/176848_70794/rp-hosting/5813/6813/descom_processwire/wire/core/PageFinder.php line 305)

 
#0 [internal function]: ProcessWire\PageFinder->___find(Object(ProcessWire\Selectors), Array)
#1 /kunden/176848_70794/rp-hosting/5213/681312/wire/core/Wire.php(264): call_user_func_array(Array, Array)
#2 /kunden/176848_70794/rp-hosting/5213/681312/wire/core/WireHooks.php(550): ProcessWire\Wire->_callMethod('___find', Array)
#3 /kunden/176848_70794/rp-hosting/5813/681312/wire/core/Wire.php(288): ProcessWire\WireHooks->runHooks(Object(ProcessWire\PageFinder), 'find', Array)
#4 /kunden/176848_70794/rp-hosting/5213/681312/wire/core/Pages.php(229): ProcessWire\Wire->__call('find', Array)
#5 /kunden/176848_70794/rp-hosting/5213/681312//wire/core/Pages.php(229): ProcessWire\PageFinder->find(Object(ProcessWire\Selectors), Array)
#6
 
This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged.
<?php
$out = '';

if($q = $sanitizer->selectorValue($input->get->q)) {

	// Send our sanitized query 'q' variable to the whitelist where it will be
	// picked up and echoed in the search box by the head.inc file.
	$input->whitelist('q', $q); 

	// Search the title, body and sidebar fields for our query text.
	// Limit the results to 50 pages. 
	// Exclude results that use the 'admin' template. 
	$matches = $pages->find("title~=$q, limit=50"); 

	$count = count($matches); 

	if($count) {
		$out .= "<h2>Found $count pages matching your query:</h2>" . 
			"<ul class='nav'>";

		foreach($matches as $m) {
			$out .= "<li><p><a href='{$m->url}'>{$m->title}</a><br />{$m->summary}</p></li>";
		}

		$out .= "</ul>";

	} else {
		$out .= "<h2>Sorry, no results were found.</h2>";
	}
} else {
	$out .= "<h2>Please enter a search term in the search box (upper right corner)</h2>";
}
?>

thanks in advance,

ocr_a

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...