On Sat, 23 Feb 2002, Jon Shorie wrote:

> I am working on a perl application that manages a database created in Mysql.
> I am having trouble with the delete statement.  Here is a portion of the
> perl code
> that is being executed:
> 
> $dbh=DBI->connect("dbi:mysql:clientdb:localhost","web","webpassword");
> 
> ###################
> # Delete Routine         #
> ###################
> 
> if ($action eq 'delete'){
>    $st_text = "DELETE FROM client WHERE (idnumber='$submitidnumber');";
>    print "$st_text";
>    $sth = $dbh->prepare( $st_text ) or die "Could not prepare $st_text" ;

You've prepared the statement, but you haven't executed it.  You need

  $sth->execute; 

here. 

> 
> # Close the table.
> 
>  print " <BR><H2>Record $submitidnumber Deleted Successfully!</H2>
> <br>
> <br>
> <a href='resultscompany'>Back to Browse/View Screen</a>
> <BR>
> <a href='main.cgi'>Back to Main Menu</a>
> <BR>
> <A HREF='http://10.0.0.3'>Back to the home page</A>
> </BODY>
> </HTML>";
> 
> Note:  $submitidnumber is populated elsewhere in the script.  
> 
> If the code is executed, no error pops up, and the query is printed on the
> screen:
> 
> DELETE FROM client WHERE (idnumber='sho002');
> 
> but the record is not being deleted.  If I copy the command to the mysql
> console, it does successfully delete the record.  Bye the way, other
> queries--select and update are working from the perl scripts.
> 
> Help please.
> 

Michael Stassen
University Information Technology Services
Indiana University Bloomington
[EMAIL PROTECTED]


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <mysql-unsubscribe-##L=##[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to