I rebooted MySQL and it now works fine ;)<br><br><div class="gmail_quote">On Fri, Sep 17, 2010 at 9:26 AM, Victor Subervi <span dir="ltr"><<a href="mailto:victorsubervi@gmail.com">victorsubervi@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Here's some more data:<br><br>        print 'insert into Passengers values (Null, %s, %s, %s, %s, %s, %s, %s, %s, "no", "n/a")' % (curr_flight, curr_customer, name, curr_sex, curr_weight, price, curr_rt, curr_confirmation)<div class="im">
<br>
        cursor.execute('insert into Passengers values (Null, %s, %s, %s, %s, %s, %s, %s, %s, "no", "n/a")', (curr_flight, curr_customer, name, curr_sex, curr_weight, price, curr_rt, curr_confirmation))<br>
</div>
        database.commit()<br>        cursor.execute('select last_insert_id() from Passengers')<br>        last_insert_id = cursor.fetchone()[0]<br>        print 'update Passengers set name=%s, weight=%s where id=%s' % (name, curr_weight, last_insert_id)<br>

        cursor.execute('update Passengers set name=%s, weight=%s where id=%s', (name, curr_weight, last_insert_id))<br>        database.commit()<br><br>This prints out:<br><br>insert into Passengers values (Null, 1, 1, Dr. Mengela, Male, 155, 100, 100, 654, "no", "n/a")
<br>update Passengers set name=Dr. Mengela, weight=155 where id=15<br><br>Here's what's in the database:<br><br>mysql> select * from Passengers;<br>+----+------------+-------------+------+------+--------+-------+------------+--------------+----------+---------------+<br>

| id | flights_id | customer_id | name | sex  | weight | price | round_trip | confirmation | late_fee | late_fee_paid |<br>+----+------------+-------------+------+------+--------+-------+------------+--------------+----------+---------------+<br>

|  1 |          1 |           1 | ''   | NULL |   NULL |  0.00 |          0 | 12345        | NULL     | NULL          | <br>| 15 |          1 |           1 | ''   | Male |   NULL |  0.00 |        100 | 654          | no       | n/a           | <br>

+----+------------+-------------+------+------+--------+-------+------------+--------------+----------+---------------+<br>2 rows in set (0.00 sec)<br><br>mysql> describe Passengers;<br>+---------------+-------------------------------+------+-----+---------+----------------+<br>

| Field         | Type                          | Null | Key | Default | Extra          |<br>+---------------+-------------------------------+------+-----+---------+----------------+<br>| id            | int(11)                       | NO   | PRI | NULL    | auto_increment | <br>

| flights_id    | int(11)                       | NO   | MUL | NULL    |                | <br>| customer_id   | int(11)                       | NO   | MUL | NULL    |                | <br>| name          | varchar(40)                   | YES  |     | NULL    |                | <br>

| sex           | enum('Male','Female')         | YES  |     | NULL    |                | <br>| weight        | int(11)                       | YES  |     | NULL    |                | <br>| price         | float(6,2)                    | NO   |     | NULL    |                | <br>

| round_trip    | tinyint(1)                    | NO   |     | 1       |                | <br>| confirmation  | varchar(20)                   | YES  |     | NULL    |                | <br>| late_fee      | enum('no','yes')              | YES  |     | no      |                | <br>

| late_fee_paid | enum('n/a','paid','not paid') | YES  |     | n/a     |                | <br>+---------------+-------------------------------+------+-----+---------+----------------+<br>11 rows in set (0.00 sec)<br>

<br>and when I run the update:<br><br>mysql> select * from Passengers;<br>+----+------------+-------------+-------------+------+--------+-------+------------+--------------+----------+---------------+<br>| id | flights_id | customer_id | name        | sex  | weight | price | round_trip | confirmation | late_fee | late_fee_paid |<br>

+----+------------+-------------+-------------+------+--------+-------+------------+--------------+----------+---------------+<br>|  1 |          1 |           1 | ''          | NULL |   NULL |  0.00 |          0 | 12345        | NULL     | NULL          | <br>

| 15 |          1 |           1 | Dr. Mengela | Male |    155 |  0.00 |        100 | 654          | no       | n/a           | <br>+----+------------+-------------+-------------+------+--------+-------+------------+--------------+----------+---------------+<br>

2 rows in set (0.00 sec)<br><br>Please explain why it does that!<br>TIA,<br>beno<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Fri, Sep 17, 2010 at 8:51 AM, Victor Subervi <span dir="ltr"><<a href="mailto:victorsubervi@gmail.com" target="_blank">victorsubervi@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi;<br>I have this code:<br><br>        cursor.execute('insert into Passengers values (Null, %s, %s, %s, %s, %s, %s, %s, %s, "no", "n/a")', (curr_flight, curr_customer, name, curr_sex, curr_weight, price, curr_rt, curr_confirmation))<br>


<br>Now, when I print it out, add quotes where necessary and enter it in at a mysql prompt, all goes well. But when I do it this way, it enters null values for curr_customer and curr_weight! Same darn thing printed out works at the prompt. What gives?<br>


TIA,<br>beno<br>
</blockquote></div><br>
</div></div></blockquote></div><br>