MySQL Forums
Forum List  »  Perl

UPDATE ... WHERE writing a new line
Posted by: Paul A
Date: November 17, 2012 10:34AM

I am having trouble converting valid MySQL command line to Perl. This works:

mysql> UPDATE control_number SET ctrlnum=714568 WHERE id = 1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> SELECT * FROM control_number;
+---------+------+
| ctrlnum | id |
+---------+------+
| 714568 | 1 |
+---------+------+

But when I run it in a production .pl (increment by 1 every time the script is called), it writes a new line:

my $sth = $dbh->prepare("UPDATE control_number SET ctrlnum='$max' WHERE id = 1;");
$sth->execute;
+---------+------+
| ctrlnum | id |
+---------+------+
| 714568 | 1 |
| 714569 | NULL |
+---------+------+

Cane somebody please help? Many thanks. -- Paul

Options: ReplyQuote


Subject
Written By
Posted
UPDATE ... WHERE writing a new line
November 17, 2012 10:34AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.