An error while installing a pluging for my website! any experts here pleaaaaase help!

Hello There,I am new in here just Joined the forum, well my problem is I am using Flynax software, I have installed a plugin and got this error message while loading my website:

MYSQL ERROR
Error:	Undeclared variable: sale
Query:	SELECT DISTINCT SUBSTRING_INDEX(GROUP_CONCAT(DISTINCT `T6`.`Thumbnail` ORDER BY `T6`.`Type` DESC, `T6`.`ID` ASC), ',', 1) AS `Main_photo`, `T1`.*, `T4`.`Path`, `T4`.`Parent_ID`, `T4`.`Type` AS `Listing_type` FROM `fl_listings` AS `T1` LEFT JOIN `fl_listing_plans` AS `T2` ON `T1`.`Featured_ID` = `T2`.`ID` LEFT JOIN `fl_listing_plans` AS `T3` ON `T1`.`Plan_ID` = `T3`.`ID` LEFT JOIN `fl_categories` AS `T4` ON `T1`.`Category_ID` = `T4`.`ID` LEFT JOIN `fl_listing_photos` AS `T6` ON `T1`.`ID` = `T6`.`Listing_ID` LEFT JOIN `fl_accounts` AS `T7` ON `T1`.`Account_ID` = `T7`.`ID` WHERE ( UNIX_TIMESTAMP(DATE_ADD(`T1`.`Featured_date`, INTERVAL `T2`.`Listing_period` DAY)) > UNIX_TIMESTAMP(NOW()) OR `T2`.`Listing_period` = 0 ) AND ( UNIX_TIMESTAMP(DATE_ADD(`T1`.`Pay_date`, INTERVAL `T3`.`Listing_period` DAY)) > UNIX_TIMESTAMP(NOW()) OR `T3`.`Listing_period` = 0 ) AND `T4`.`Type` = 'sale_rent' AND `T1`.`Status` = 'active' AND `T4`.`Status` = 'active' AND `T7`.`Status` = 'active' GROUP BY `T1`.`ID` ORDER BY `Last_show` ASC, RAND() LIMIT sale
Function:	eval
File:	/includes/classes/rlHook.class.php (line# 121)

Anyone can please help me urgently ?? :confused::confused:

This error shows that you have an undeclared variable called sale, here is the source of your problem:


LIMIT sale

Are you sure its not supposed to be $sale? Or is sale some kind of constants(in this case it can be SALE, I assume capitalized letter notation for PHP constants) or database internal variables?

Thank you for your quick reply, well am not an expert but, I will copy and paste the whole php page here hope this can explain something to you and help me :slight_smile:

<?php

/******************************************************************************
 *
 *	
 *
 ******************************************************************************/

class rlHook extends reefless
{
	/**
	* @var validator class object
	**/
	var $rlValid;
	
	/**
	* @var common class object
	**/
	var $rlCommon;
	
	/**
	* @var hooks array
	**/
	var $rlHooks;
	
	/**
	* class constructor
	**/
	function rlHook()
	{
		global $rlValid, $rlCommon;
		
		$this -> rlValid = $rlValid;
		$this -> rlCommon = $rlCommon;
		
		/* get hooks */
		$this -> getHooks();
	}

	/**
	* get all active hooks
	*
	* @return array - hooks array
	**/
	function getHooks()
	{
		$this -> setTable('hooks');
		$tmp_hooks = $this -> fetch( array('Name', 'Code'), array('Status' => 'active') );
		$this -> resetTable();
		
		foreach ($tmp_hooks as $key => $value)
		{
			if (!$hooks[$tmp_hooks[$key]['Name']])
			{
				$hooks[$tmp_hooks[$key]['Name']] = $tmp_hooks[$key]['Code'];
			}
			else
			{
				$tmp_hook = $hooks[$tmp_hooks[$key]['Name']];
				
				unset($hooks[$tmp_hooks[$key]['Name']]);
				
				if (is_array($tmp_hook))
				{
					$tmp_hook[] = $tmp_hooks[$key]['Code'];
					$hooks[$tmp_hooks[$key]['Name']] = $tmp_hook;
				}
				else
				{
					$hooks[$tmp_hooks[$key]['Name']][] = $tmp_hooks[$key]['Code'];
					$hooks[$tmp_hooks[$key]['Name']][] = $tmp_hook;
				}
			}
			unset($tmp_hook);
		}

		unset($tmp_hooks);
		$this -> rlHooks = $hooks;
		$GLOBALS['hooks'] = $hooks;
	}
	
	/**
	* load hook
	*
	* @param string - hook name
	*
	**/
	function load( $name = false )
	{
		if ( is_array($name) )
		{
			$name = $name['name'];
			$hooks = $GLOBALS['hooks'];
		}
		else
		{
			$hooks = $this -> rlHooks;
		}

		$code = $hooks[$name];
		if ( !empty($code) )
		{
			if (is_array($code))
			{
				foreach ($code as $item)
				{
					eval($item);
				}
			}
			else
			{
				eval($code);
			}
		}
	}
}

Line 121 means : eval($item);

I don’t think the error lies in the code you posted above, there’s nothing wrong with the eval() method, the item variable contains incorrect/non-executable PHP code and that’s the root of your problem. The error message may say line 121 in your class file, but you need to examine the item variable to debug.

Apparently it has something to do with the creation/generation of SQL query, but it’s not found in the class file you posted. Did you post the entire class? Where is the fetch() method? Is it responsible for generating the limit clause in your SQL query?

Yes, I have copied and pasted the whole code of the php page mentioned on the error message!
I just can’t understand what ‘‘sale’’ means it’s not even on the php code! fetch() method? I don’t know really!
what do you suggest me to do? the plugin I was trying to install is called ‘‘Listings_carousel’’ ! :frowning:

Get a hold of the developer of that plugin (that’s where I’d start).

As cpradio said, you’d better consult the developer for this problem you encountered. It seems that the SQL query aint constructed properly, this may as well be a bug within the plugin. In this case, its your best interest to ask the developers to resolve such glitches, unless it is already a legacy code that no one will bother fixing its glitches.

@ListsID ; Don’t get us wrong, we’d be glad to help, but it will take us ages to get through this issue with you (post after post after post). If you can’t get a hold of the plugin developer, please do come back to this thread and say so. We can go through the process, but to be honest, we’d be doing a lot of guessing until we can start to identify 1) how this plugin system works, 2) what the plugin is intending to do, and 3) how the table structure is built and interacts with everything.

That’s a lot to try and collect/identify and it could take us a long while before we get there (only to find out, we barked up the wrong tree and have to start all over).

Thank Guys for your explanations ! :slight_smile: