List:General Discussion« Previous MessageNext Message »
From:Sasha Pachev Date:July 9 1999 4:52pm
Subject:Re: Deleting one record using Perl
View as plain text  
"Robert (IMI)" wrote:
> 
> I am using a perl program to delete a record..
> 
> I have read in the online manual about deleting one record from a console.. that
> works great..
> DELETE FROM users WHERE username = "55tiger";
> 
> But then I tried to use the same sort of syntax in my program and it doesnt seem to
> work.. I am not getting a error.. its just not taking out the record.. I will of course
> keep working on it.. but any clues would be great..
> 
> Here is the code I am using.. I first connect to the database.. then do the
> following:
> 
>  $sql = qq{
>   DELETE FROM users
>   WHERE username = "FORM{'username'}"
>  };
> 
>  $sth = $dbh->prepare($sql);
>  $sth->execute;
> 
>  $dbh->disconnect;

I think you are missing $ before FORM.

A note for everybody: If a query seems to work fine from the command
line, but does not seem to work or works different in the application,
the most likely cause is that you are not running the same query! Try
either printing the query before you execute it or check the mysql log
to make sure you are executing the correct query. Monty, maybe this
should be added to the manual.

-- 
Sasha Pachev
http://www.sashanet.com/ (home)
http://www.direct1.com/ (work)
Thread
Deleting one record using PerlIMI)9 Jul
  • Re: Deleting one record using PerlSasha Pachev9 Jul
  • Re: Deleting one record using Perl - Sorry about that..IMI)9 Jul
RE: Deleting one record using PerlDarren L Sweeney9 Jul