MySQL Forums
Forum List  »  Perl

MySql, Perl, and HTML Update function not working
Posted by: adam gruber
Date: January 31, 2013 03:59PM

I used a guide that I found that was written by Tony Darnell regarding using MySql, Perl, and a little HTML to create, update, and delete database records. Everything works perfectly, except for the UPDATE functionality. Is there anything explicitly wrong with the following lines

$serial = $formdata{'serial'};
$name_first = $formdata{'name_first'};
$name_last = $formdata{'name_last'};
$address_01 = $formdata{'address_01'};
$address_02 = $formdata{'address_02'};
$address_city = $formdata{'address_city'};
$address_state = $formdata{'address_state'};
$address_postal_code = $formdata{'address_postal_code'};

$dbh = ConnectToMySql($Database);

$query = "update address set name_first = '$name_first', name_last = '$name_last', address_01 = '$address_01', address_02', address_city = '$address_city', address_state = '$address_state', address_postal_code = '$address_postal_code' where serial = '$serial'";

$sth = $dbh->prepare($query);



When I takek out the $serial and enter in a manual value in the $query line, it works. So something is not kosher with having it grab that value on its own. I am a complete MySql and Perl n00b btw, so I apologize right off the bat if i misunderstand something or am missing something easy. Thanks for the help and let me know if you need any other info.

Options: ReplyQuote

Written By
MySql, Perl, and HTML Update function not working
January 31, 2013 03:59PM

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.