Skip navigation links

MySQL Forums :: Perl :: UPDATE ... WHERE writing a new line


Advanced Search

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 Paul A 11/17/2012 10:34AM
Re: UPDATE ... WHERE writing a new line Rick James 11/18/2012 03:39PM
Re: UPDATE ... WHERE writing a new line Paul A 11/19/2012 02:02PM
Re: UPDATE ... WHERE writing a new line Randy Clamons 11/19/2012 01:07PM
Re: UPDATE ... WHERE writing a new line Paul A 11/19/2012 02:07PM


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.