但是我不知道该怎么做。为了使bindValues与数组一起工作,我在尝试时不断出错。
$text = htmlspecialchars($text);
// prepare the mysql query to select the users
$get_product = $connect->prepare("SELECT name FROM products WHERE name LIKE concat('%', :name, '%') ORDER BY created DESC LIMIT ?, ? ");
$get_product->bindValue(1, $from_record_numLiveSearch, PDO::PARAM_INT);
$get_product->bindValue(2, $records_per_pageLiveSearch, PDO::PARAM_INT);
// execute the query
$get_product -> execute(array('name' => $text));
感谢您的时间和回答。
//$text = htmlspecialchars($text);
$get_product = $connect->prepare("SELECT name FROM
products ORDER BY created DESC LIMIT ?, ? ");
$get_product->bindValue(1,
$from_record_numLiveSearch, PDO::PARAM_INT);
$get_product->bindValue(2,
$records_per_pageLiveSearch, PDO::PARAM_INT);
$get_product->execute();