I see what you mean. I don't believe that is possible. See below (From http://dev.mysql.com/doc/refman/5.5/en/information-functions.html#function_last-insert-id)
If you insert multiple rows using a single INSERT statement, LAST_INSERT_ID() returns the value generated for the first inserted row only. The reason for this is to make it possible to reproduce easily the same INSERT statement against some other server.
CarlThanks 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.RegardsAustinOn 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 AllI 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 stuffWith 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/ ]
--
[ Drupal support list | http://lists.drupal.org/ ]