codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  mysql issue with delete  tweak at 16:17 on Wednesday, April 25, 2007
 

Hi
I have created a mysql table and am having trouble deleting a row from it.

My create/insert code looks like this (this works fine):
------------
my $dbh = DBI->connect($dsn, $dbUser, $dbPass);
$dbh->do("CREATE TABLE IF NOT EXISTS $dbname (
category VARCHAR(60) PRIMARY KEY,
heading VARCHAR(60)
)");
$dbh->do("INSERT INTO $dbname VALUES('$category', '$heading')");
$dbh->disconnect();
------------

But my delete code (below) doesn't seem to delete the specified row - the table just remains unchanged. Can anyone with DBI and mySql experience let me know if there is an obvious syntax issue or error? Many thanks :)

### Connect to MySQL database to delete this category
my $dbh = DBI->connect($dsn, $dbUser, $dbPass);
# delete the category
$dbh->do("DELETE FROM $dbname WHERE category=$catName");
# disconnect from database
$dbh->disconnect();










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: dynamic crystal report generation
•  Writing form data to output files
•  date of birth validation using java script-very urgent
•  c++ beginner need some help
•  Menu.Prototype.cssFile
•  Perl`s Greedy and Non-Greedy Quantifiers
•  Perl`s Regular Expression Engine
•  Perl`s Regular Expression Engine
•  mysql issue with delete


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007