|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
I try to create a new table for mySQL datebase. But it isn't succesfull. Every time after creating I try to test with
db->do("DROP TABLE $tablename") but $tablename doesn't exist. How is it possible? Thanks. |
|
#2
|
||||
|
||||
|
Just check it out whether $tablename is set or not?. i crate a table like this... #!/usr/bin/perl use CGI; use DBI; $dbh=DBI->connect('dbi:mysql:databasename','username','pwd'); #connect to the database .. #enter your database name ,username and password to the connection string.. $sql="create table tblname(name varchar(30))"; #create table command. $sth = $dbh->prepare($sql) or die "Can't prepare $sql: $dbh->errstrn"; #pass sql query to database handle.. $sth->execute or die "can't execute the query: $sth->errstrn"; #execute the query here. ###############--- After this try to insert some record into it. or probably you can issue a "show tables" command to see wether your table is existing in the database or not. ------------------ SR - shiju.dreamcenter.net "The fear of the LORD is the beginning of knowledge..." |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > How can I create a new table for mySQL datebase? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|