Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in : <p>I have this problem with short php code I am using in to get suggestions for  JQuery autocomplete. I have tried many things but I am unable to find solution:</p>

<pre><code>//connect to your database
&lt;?php require('Connections/con_1.php');?&gt;
&lt;?php

//retrieve the search term that autocomplete sends
$term = trim(strip_tags($_REQUEST['term']));

//save search queries to csv file
$file = fopen("searchqueries.csv","a");
fputcsv($file,explode(',',$term));
fclose($file);

//query the database for entries containing the term
$qstring ="USE database_2";"SELECT DISTINCT Pracodawca as value FROM Pensje WHERE Pracodawca LIKE '%".$term."%'";
$result = mysql_query($qstring) or die($result.mysql_error());

//loop through the retrieved values        
while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
    {

    //build an array
    $row['value']=htmlspecialchars(stripslashes($row['value']));
    $row_set[] = $row['value'];
    $row['value']=
    $row_set[] = array('value' =&gt; ($row['value']));
    }

//format the array into json data
echo json_encode($row_set, JSON_UNESCAPED_UNICODE);
?&gt;
</code></pre>

<p>I get error <em>"Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in"</em> and the result is <em>NULL</em>.</p>

<p>What I am doing wrong?</p>
