|
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();
|
|
|
|
|
|
|
// |