in reply to Perl Mysql

So , this is going to sound ill-informed, or under educated, but,,,

I don't have to use Mysql to connect to Mysql Databases?
Which has prepare() in it?
Can you show me an example of code to run a basic query on a mysql database? I just will be doing 3 things, dropping a table, adding a table, and then inserting into a table.

I have such a headache, switching between csh, perl, and php all day on this...

Thanks in advance for helping me.

Replies are listed 'Best First'.
Re: Re: Perl Mysql
by MrCromeDome (Deacon) on Sep 21, 2001 at 23:17 UTC
    Providing that you have DBI and DBD::MYSQL installed. . .

    Connecting to a database:

    my $database = DBI->connect("DBI:mysql:database_name,'user','pw') or die "Could not connect to database: " . DBI->errstr;
    To drop a table:
    my $script = "DROP TABLE your_tablename "; my $sql = $database->prepare_cached($script) || die "Couldn't prepare SQL: " . $database->errstr; $sql->execute() || die "Can't execute SQL: " . $database->errstr; $sql->finish();
    You should really read the documentation on DBI. It's much more complete than this. But this should get you started.

    Hope this helps!
    MrCromeDome