#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    1
    Rep Power
    0
    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. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    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..."

IMN logo majestic logo threadwatch logo seochat tools logo