Jump to content

Hellp with search


rastaman46

Recommended Posts

What i trying to do is make search with multiple  check boxes

 

here is may error im get

 

Please try again later or contact an Administrator.
(1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Inner Join rasta_cinema_categories AS r ON cat = r.cat WHERE upper() LIKE'%%'' at line 2 SELECT `video_id`, `name`, `description`, `video_name`, `thumb_image`, `release`, `cat`, `format`, `imbd_url`,`added`, `recomended` ,`sticky`, `owner`, `clicks` FROM `rasta_cinema` AS Inner Join rasta_cinema_categories AS r ON cat = r.cat WHERE upper() LIKE'%%'

 

 

and here is the code

 

$searching = (isset($_POST['searching']) ? $_POST['searching'] : '');
if ($searching =="yes") 
{  
$paieska =  (isset($_POST['find']) ? $_POST['find'] : ''); 
if ($paieska == "")  
{ 
$klaida  = '<div class="error" id="show_error">You forgot to enter a search term</div>'; 
}
$checkbox = $_POST['cat'];

if ($checkbox !='')
{
$extra = " and `cat` IN(". explode(', ',$checkbox) . ")";
}
       
        $cinema = '';		
		$filmai = $TSUE['TSUE_Database']->query("SELECT `video_id`, `name`, `description`, `video_name`, `thumb_image`, `release`, `cat`, `format`, `imbd_url`,`added`, `recomended` ,`sticky`, `owner`, `clicks`  FROM `rasta_cinema` AS
	Inner Join rasta_cinema_categories AS r ON cat = r.cat WHERE upper($field) LIKE'%$paieska%'".$extra);   
        $numrows = mysqli_num_rows($filmai);
	if($numrows == 0)
	{
        $klaida = '<div class="error" id="show_error">Nothing found</div>';                       
        }
	while ($row = mysqli_fetch_array($filmai)) {
	$cinema_row = '';
        $id = $row['video_id'];
	$name = $row['name'];
	$description = $row['description'];
	$video_name = $row['video_name'];
	$thumb = $row['thumb_image'];
	$release = $row['release'];
	$format = $row['format'];
	$imbd_url = $row['imbd_url'];
	$cat = $row['cat'];
	$owner = $row['owner'];
	$clicks = $row['clicks'];
	$data = date('Y-m-d H:i:s',$row['added']);
	$nujo = $row['recomended'];
	$sticky = $row['sticky'];
	         $free = "";
                 if ($row['recomended'] == 1){ 
                 $free = '<img title="Recomended" src="/cinema/images/heart.png"/>';
                    }
				$sticky = "";
				if ($row['sticky'] == 1){ 
                 $sticky = '<img title="Sticky" src="/cinema/images/pin.png"/>';
                    }

				$recomended = '';
				$recomended = $free.$sticky;
        eval("\$cinema_row = \"".$TSUE['TSUE_Template']->LoadTemplate('cinema_row')."\";");
	$cinema .= $cinema_row;
}

}  

 

 

Link to comment
https://forums.phpfreaks.com/topic/260974-hellp-with-search/
Share on other sites

You are missing an actual alias name after the: AS ___.

 

You should form your query statement in a php variable and then output the whole actual query statement as part of your error handling logic so that you can see exactly what the query statement is that is failing.

Link to comment
https://forums.phpfreaks.com/topic/260974-hellp-with-search/#findComment-1337514
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.