I currently have the following:
$stmt = $conn->prepare("SELECT COUNT(*) FROM items WHERE quality LIKE :quality AND type LIKE :type AND name LIKE :name ".$amount);
$stmt->bindParam(':quality', $quality);
$stmt->bindParam(':name', $name);
$stmt->bindParam(':type', $type);
$stmt->execute();
$total = $stmt->rowCount();
This will always return 1. Yet when doing:
SELECT * FROM items WHERE quality LIKE :quality AND type LIKE :type AND name LIKE :name ".$amount
It will return all the items that match the query. When doing a broad search the LIKE's will be set to % rather than an actual name due to a search box.
Is this an issue with the LIKE %? I'm needing to get how many items there are within that query so I can see the total amount of pages by doing
$pages = ceil($total / $limit);
$amount is the following:
if ($_GET['amount'] == "2") { $amount = "AND points <=".$result[0]['points']; }