This question already has an answer here:
- Can I mix MySQL APIs in PHP? 4 answers
i am trying to fetch product list from mysql table. I am trying the following code but it is not working. Any suggestions please.
Fatal error: Call to undefined method mysqli_stmt::rowCount()
Code
$query = "SELECT id, name, price FROM female_products ORDER BY name";
$stmt = $con->prepare( $query );
$stmt->execute();
$num = $stmt->rowCount();
if($num>0)
{
//my work here
}
Config.php
$db_username = 'root';
$db_password = '';
$db_name = 'ecommerce';
$db_host = 'localhost';
try {
$con = new mysqli($db_host, $db_username, $db_password,$db_name);
}catch(PDOException $exception){
echo "Connection error: " . $exception->getMessage();
}
</div>