num_rows Always shows Zero value in PHP/MYSQL? -


i totally new php.

i practicing prepared statements. know there few questions related mine.

but nothing helped me.

this php code returns num_rows equal zero.

but there data in table

   if (isset($_post['submit'])) {                         $my_id = 49;                         $content = $_post['cont'];                         $content_date = date('d-m-y');                         $check = "select * post user_id = ?";                         $stmt = $con->prepare($check);                         $stmt->bind_param("i",$my_id);                         $stmt->execute();                         $stmt->fetch();                         $numberofrows = $stmt->num_rows;                         $stmt->close();                         echo '<h1>'.$numberofrows.'</h1>';                        } 

use () this... $numberofrows = $stmt->num_rows(); , try.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -