DBI/PERL Tutorial over the Web

Click to go to the PREVIOUS page. Click to go to the INDEX page. Click to go to the NEXT page.

SLIDE #5 INSERT RECORD INTO TABLE


In this fifth slide, we insert a record into the table.

1. THE INSERT INTO TABLE STATEMENT:

#Insert data into table
        $statement="insert into studios (id, name, city, state) 
		values ('5', 'big picture', 'Culver City', 'CA')";
        $sth=$dbh->prepare($statement);
        $rv=$sth->execute;
        print $statement."<br>";

2. FORM DESCRIPTION:

The first line defines the SQL statement.

The second line creates a statement object, calling the prepare method on the 
database object, and using the statement as parameter.

The third line calls the execute method on the  statement object

The fourth line displays the statement.


© Copyright 2002 International Customized Software Co.