Fatal error: 'SQLSTATE[HY093]:

include $_SERVER['DOCUMENT_ROOT'] . '/includes/db2.inc.php';
	//The basic SELECT statement
	$select = 'SELECT id, ename,timeupdate';
	$FROM = ' FROM product';
	$where = ' WHERE TRUE';

	$placeholders = array();
	
	$typein = $_GET['product_name'];
	$where .= " AND editorid = :editorid AND cname LIKE :cname OR ename LIKE :ename";
	$placeholders[':editorid'] = $_SESSION['id'];
	$placeholders[':cname'] = '%' . $typein . '%';
$placeholders[':ename'] = '%' . $typein . '%';
	
	try
	{
		$sql = $select . $from . $where;
		$s = $pdo->prepare($sql);
		$s->execute($placeholders);
	}
	catch (PDOException $e)
	{
		$error = 'error fetching product_name info';
		include 'error.html.php';
		exit();	
	}
	
foreach ($s as $row)
{
	$productlist[] = array('id' => $row['id'], 'cname' => $row['cname'], 'ename' => $row['ename'], 'timeupdate' .......
}

the error is :

Can anyone tell me how to solve this problem?

I finally find out that the $FORM should be $form

1 Like

Ah, yes, PHP variable names are all case-sensitive, so using $form is not the same as using $Form or $FORM or $fOrm. Non-intuitive error message, though, as the bound parameters look fine.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.