adding fields to mySOL

Am connecting using the following...
$dsn = "DBI:$dbDriver:database=$dbName";
$db_handle = DBI->connect($dsn, $usrName, $dbPassword);

How can I add fields to the db?


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

$dbh = DBI->connect("DBI:mysql:dbname", "usr", $pass) or
    die "unable to connect to the database: $DBI::errstr\n";

$wquery = qq( insert into addresses (name,email,tel) values (?,?,?));
$sth = $dbh->prepare($wquery) or die $dbh->errstr;
      $sth->execute($name,$email,$tel) or die $sth->errstr;

see full working demo @ script mysql

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
stephenbladeAuthor Commented:
How do I create the table "addresses"?

create table addresses ( id integer not null auto increment, name VARCHAR(64), email VARCHAR(64), tel CHAR(16) );
stephenbladeAuthor Commented:
So what am I doing wrong? I just want to create the table right now..

$dsn = "DBI:$dbDriver:database=$dbName";

$db_handle = DBI->connect($dsn, $usrName, $dbPassword);

if( $db_handle )
print "connected";
create table registrations ( id integer not null auto increment, name VARCHAR(64), email VARCHAR(64), add1 CHAR(64), add2 CHAR(64), add3 CHAR(64), bids CHAR(600));
print "Tables Created";
 } else {
print "Error";

see code above. 'create table' should be part of a query string that you define before preparing and executing a query.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.