Display Message if num_rows = 0 in php from mysqli prepared-statement -


I have a problem trying to get the number of rows from a prepared statement query in php, my query looks as follows : $ DBH = getDBH (); $ Stmt = $ DBH- & gt; Ready ("list list WHERE tag =" from selection list? "); $ Stmt- & gt; Bind_param ("s", $ tag); $ Stmt- & gt; Executed (); $ Stmt- & gt; Bind_result ($ info);

And I basically just want to say that no result results were shown "no results returned" Can anyone help?

You must firstly $ statement-> Using store_result () will use your code:

  $ DBH = getDBH (); $ Stmt = $ DBH- & gt; Ready ("list list WHERE tag =" from selection list? "); $ Stmt- & gt; Bind_param ("s", $ tag); $ Stmt- & gt; Executed (); $ Stmt- & gt; Store_result (); $ Num_rows = $ stmt-> Num_rows; $ Stmt- & gt; Bind_result ($ info);    

Comments