[support] db_query(INSERT return value

Austin Einter austin.einter at gmail.com
Thu Apr 21 00:06:38 UTC 2011


Hi All
I have a table *resubmt_skill_ids, *it has two coulmns, skillid (primary
key) and skillname (unique key).
I have below code. ,

*  $query_string = "INSERT INTO resubmt_skill_ids (skillname)
VALUES  ('php'), ('sql')  "  ;
  $result = db_query($query_string);

  if($result)
  {
   while($obj = **db_fetch_array($result))
   {*
* *
*           //DO Other stuff*

With this I get the warning:
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.

As per Drupal documentation db_query should return "A database query result
resource, or FALSE if the query was not executed correctly."
So if($result) condition turns out to be true, can I guess that there will
be atleast 1 record in $result.

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.

Thanks Austin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20110421/2ed27aef/attachment.html 


More information about the support mailing list