List:General Discussion« Previous MessageNext Message »
From:Victor Subervi Date:December 27 2009 4:13pm
Subject:last_insert_id
View as plain text  
Hi;

mysql> select * from products;
+----+----------+----------+-------+--------+-------------+-------+------------+--------------+------------+-------------+------------------+-------------------+--------------+-----------+---------------+--------+----------+--------------+------+------+-------------+--------------------------+
| ID | SKU      | Category | Name  | Title  | Description | Price |
SortFactor | Availability | OutOfStock | ShipFlatFee | ShipPercentPrice |
ShipPercentWeight | Associations | TempPrice | LastDatePrice | Weight |
Metal    | PercentMetal | pic0 | pic1 | sizes       |
colorsShadesNumbersShort |
+----+----------+----------+-------+--------+-------------+-------+------------+--------------+------------+-------------+------------------+-------------------+--------------+-----------+---------------+--------+----------+--------------+------+------+-------------+--------------------------+
|  1 | prodSKU1 | prodCat1 | name1 | title1 | desc        | 12.34 |
500 |            1 |          0 |       10.00 |                5
|                 2 |              |         1 | 2000-01-01    |   2.50 |
14k gold |           20 | NULL | NULL | Extra-small
|                          |
+----+----------+----------+-------+--------+-------------+-------+------------+--------------+------------+-------------+------------------+-------------------+--------------+-----------+---------------+--------+----------+--------------+------+------+-------------+--------------------------+
1 row in set (0.00 sec)

mysql> select last_insert_id() from products;
+------------------+
| last_insert_id() |
+------------------+
|                0 |
+------------------+
1 row in set (0.00 sec)

mysql>

Now, I was expecting 1, not 0! What up?
TIA,
Victor

Thread
last_insert_idVictor Subervi27 Dec
  • Re: last_insert_idMattia Merzi27 Dec
    • Re: last_insert_idVictor Subervi27 Dec
      • Re: last_insert_idMichael Dykman27 Dec
        • Re: last_insert_idVictor Subervi27 Dec
          • Re: last_insert_idGary Smith27 Dec
            • Re: last_insert_idVictor Subervi27 Dec
            • Re: last_insert_idCarsten Pedersen27 Dec
  • Re: last_insert_idSteve Edberg27 Dec
    • Re: last_insert_idGary Smith27 Dec
      • Re: last_insert_idMark Goodge27 Dec