db_fetch_array() shouldn&#39;t be used on an INSERT query. You probably want to use <a href="http://api.drupal.org/api/drupal/includes--database.mysql-common.inc/function/db_last_insert_id/6">http://api.drupal.org/api/drupal/includes--database.mysql-common.inc/function/db_last_insert_id/6</a> instead.<div>
<br></div><div><div>On Wed, Apr 20, 2011 at 6:06 PM, Austin Einter <span dir="ltr">&lt;<a href="mailto:austin.einter@gmail.com">austin.einter@gmail.com</a>&gt;</span> wrote:</div><div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>Hi All</div>
<div>I have a table <em>resubmt_skill_ids, </em>it has two coulmns, skillid (primary key) and skillname (unique key).</div>
<div>I have below code. , </div>
<div> </div>
<div><em>  $query_string = &quot;INSERT INTO resubmt_skill_ids (skillname) VALUES  (&#39;php&#39;), (&#39;sql&#39;)  &quot;  ;<br>  $result = db_query($query_string);<br>  <br>  if($result)<br>  {<br>   while($obj = </em><em><strong>db_fetch_array($result))<br>

</strong>   {</em></div>
<div><em> </em></div>
<div><em>           //DO Other stuff</em></div>
<div> </div>
<div>With this I get the warning:  </div>
<div><font color="#ff0000">warning: mysqli_fetch_object() expects parameter 1 to be mysqli_result, boolean given in C:\MyWeb6.20\wamp\www\livejobs1\includes\database.mysqli.inc on line 151.</font></div>
<div> </div>
<div>As per Drupal documentation db_query should return &quot;A database query result resource, or FALSE if the query was not executed correctly.&quot;</div>
<div>So if($result) condition turns out to be true, can I guess that there will be atleast 1 record in $result.</div>
<div> </div>
<div>I found data is written to table, and want to have newly written data (both skillname and corresponding skillid), can I extract the data from $result, or I need to do one more query to get the newly written data.</div>


<div> </div>
<div>Thanks Austin</div>
<br>--<br>
[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br></blockquote></div><br></div></div></div>