Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to catch empty results of a php mysqli query
    primarykey
    data
    text
    <p>Here is the query:</p> <pre><code>$stmt = $dbconnect-&gt;prepare("SELECT `title`,`description`,`postid` FROM `posttd` WHERE MATCH `title` AGAINST ( ? IN BOOLEAN MODE)"); $stmt-&gt;bind_param('s', $value); $stmt-&gt;execute(); </code></pre> <p>The value of <code>$value</code> is 'test1', 'other' and 'test2'</p> <p>The value 'other' is a mysql stopword. So when it is passed through the query it results to nothing.</p> <p>Just want to know how to catch it so that I can take it out of the <code>$value</code> array.</p> <p><code>var_dump($stmt-&gt;execute());</code> will give <code>bool(true)</code> on all three.</p> <p>As much as possible I don't want to filter the <code>$value</code> for stopwords before running it in the query.</p> <p><code>var_dump($stmt)</code> after <code>$stmt-&gt;execute();</code> will result to the following:</p> <p><strong>test1 var_dump</strong></p> <pre><code>object(mysqli_stmt)#2 (9) { ["affected_rows"]=&gt; int(-1) ["insert_id"]=&gt; int(0) ["num_rows"]=&gt; int(0) ["param_count"]=&gt; int(1) ["field_count"]=&gt; int(3) ["errno"]=&gt; int(0) ["error"]=&gt; string(0) "" ["sqlstate"]=&gt; string(5) "00000" ["id"]=&gt; int(1) } </code></pre> <p><strong>test2 var_dump</strong></p> <pre><code>object(mysqli_stmt)#2 (9) { ["affected_rows"]=&gt; int(-1) ["insert_id"]=&gt; int(0) ["num_rows"]=&gt; int(0) ["param_count"]=&gt; int(1) ["field_count"]=&gt; int(3) ["errno"]=&gt; int(0) ["error"]=&gt; string(0) "" ["sqlstate"]=&gt; string(5) "00000" ["id"]=&gt; int(3) } </code></pre> <p><strong>other var_dump</strong></p> <pre><code>object(mysqli_stmt)#6 (9) { ["affected_rows"]=&gt; int(-1) ["insert_id"]=&gt; int(0) ["num_rows"]=&gt; int(0) ["param_count"]=&gt; int(1) ["field_count"]=&gt; int(3) ["errno"]=&gt; int(0) ["error"]=&gt; string(0) "" ["sqlstate"]=&gt; string(5) "00000" ["id"]=&gt; int(2) } </code></pre> <p>The only difference is <code>object(mysqli_stmt)#6</code></p> <p>Any ideas?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload