Table Of Contents:

Chapter 1
Account Overview

|
Chapter 2
Getting Started

|
Chapter 3
Control Panel Overview

|
Chapter 4
FTP Instructions

|
Chapter 5
SSH / Telnet

|
Chapter 6
Email Software Setup

|
Chapter 7
File Manager

|
Chapter 8
Change Password

|
Chapter 9
Mail Manager

|
Chapter 10
Site Statistics

|
Chapter 11
Mailing List

|
Chapter 12
Microsoft FrontPage

|
Chapter 13
Site Creation Tool

|
Chapter 14
Counters

|
Chapter 15
Protect Directories

|
Chapter 16
Redirect URL

|
Chapter 17
Search Engine

|
Chapter 18
Formmail

|
Chapter 19
PGP & PGP Mail

|
Chapter 20
Mime Types

|
Chapter 21
Anonymous FTP

|
Chapter 22
Archive Manager

|
Chapter 23
SSL (Secure Server)

|
Chapter 24
MySQL

|
Chapter 25
Shopping Cart

|
Chapter 26
CGI-bin

|
Chapter 27
Real Audio / Real Video

|

LinuxWebHost.com

Send a Support Request

Support Manual

Chapter 24: MySQL

Overview | MySQL Control Panel Feature | Examples of SQL Statements | Quick Actions
Advanced Queries | Table Properties | Table Select | Perl SQL Delete Example
Perl SQL Insert Example | Perl SQL Update Example | Perl While Loop Example
View Dump Database Schema | Using MySQL With CGI Scripts
References and Tutorials



Perl SQL Delete Example

Here we delete a record from the database using a DELETE statement.

# Use the DBI module use DBI qw(:sql_types); # Declare local variables my ($databaseName, $databaseUser, $databasePw, $dbh); my ($stmt, sth, @newRow); my ($telephone); # Set the parameter values for the connection $databaseName = "DBI:mysql:yourWebSite_com"; $databaseUser = "yourLoginId"; $databasePw = "yourLoginPassword"; # Connect to the database # Note this connection can be used to # execute more than one statement # on any number of tables in the database $dbh = DBI->connect($databaseName, $databaseUser, $databasePw) || die "Connect failed: $DBI::errstr\n"; # Create the statement. $stmt = "DELETE FROM Phonebook WHERE (Id = 'BBBBB')"; # Prepare and execute the SQL query $sth = $$dbh->prepare($$stmt) || die "prepare: $$stmt: $DBI::errstr"; $sth->execute || die "execute: $$stmt: $DBI::errstr"; # DELETE does not return records # Clean up the record set and the database connection $sth->finish(); $dbh->disconnect();