Carl
Thanks for reply.
 
I am writing a set of values (not a single record).
But even, db_last_insert_id(), does a SQL query.
 
What I am looking, after INSERT, is it pssoble to get array of inserted records without doing one more query.
Regards
Austin
On Thu, Apr 21, 2011 at 7:43 AM, Carl Wiedemann <carl.wiedemann@gmail.com> wrote:
db_fetch_array() shouldn't be used on an INSERT query. You probably want to use http://api.drupal.org/api/drupal/includes--database.mysql-common.inc/function/db_last_insert_id/6 instead.

On Wed, Apr 20, 2011 at 6:06 PM, Austin Einter <austin.einter@gmail.com> wrote:
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

--
[ Drupal support list | http://lists.drupal.org/ ]


--
[ Drupal support list | http://lists.drupal.org/ ]