WLHosting
04-15-2003, 07:45 PM
I have a perl script for a jokes script that somebody wants me to get running for them. The perl install script does not work. It just inserts data into the sql database. The code is as follows:
#!/usr/bin/perl
use DBI;
$dbname="";
$dbuser="";
$dbpass="";
$dbh=DBI->connect("DBI:mysql:".$dbname,$dbuser,$dbpass) or exit 1;
$dbh->do("drop table jconf");
$dbh->do(
"create table jconf(jconf_id varchar(10) primary key,".
"jconf_value integer not null)");
$dbh->do("insert into jconf(jconf_id,jconf_value) values('jonp',30)");
$dbh->do("insert into jconf(jconf_id,jconf_value) values('per',24)");
$dbh->do("drop table jip");
$dbh->do(
"create table jip(jip_id varchar(20) primary key,".
"jip_time integer not null)");
$dbh->do("drop table jcat");
$dbh->do(
"create table jcat(jcat_id integer not null auto_increment primary key,".
"jcat_name varchar(40) not null)");
$dbh->do("drop table joke");
$dbh->do(
"create table joke(joke_id integer not null auto_increment primary key,".
"jcat_id integer not null,".
"joke_caption varchar(100),".
"joke_body text,".
"joke_sname varchar(100),".
"joke_semail varchar(100),".
"joke_views integer,".
"joke_votes integer,".
"joke_sends integer,".
"joke_rating integer,".
"joke_rt float,".
"joke_added integer,".
"joke_approved integer)");
$dbh->disconnect;
I cannot run it so I am converting it over to sql and importing it in as a .sql file. I have made:
CREATE TABLE jcat (
jcat_id int(11) NOT NULL auto_increment,
jcat_name varchar(40) NOT NULL default '',
PRIMARY KEY (jcat_id)
) TYPE=MyISAM;
CREATE TABLE jconf (
jconf_id varchar(10) NOT NULL default '0',
jconf_value int(11) NOT NULL default '0',
PRIMARY KEY (jconf_id)
) TYPE=MyISAM;
INSERT INTO jconf VALUES ('jonp', 30);
INSERT INTO jconf VALUES ('per', 24);
CREATE TABLE jip (
jip_id varchar(20) NOT NULL default '0',
jip_time int(11) NOT NULL default '0',
PRIMARY KEY (jip_id)
) TYPE=MyISAM;
CREATE TABLE joke (
jcat_id integer not null,
joke_caption varchar(100),
joke_body text,
joke_sname varchar(100),
joke_semail varchar(100),
joke_views integer,
joke_votes integer,
joke_sends integer,
joke_rating integer,
joke_rt float,
joke_added integer,
joke_approved integer
)
They are not the same. I cannot get them to be the same. Can somebody help me. Thanks!
#!/usr/bin/perl
use DBI;
$dbname="";
$dbuser="";
$dbpass="";
$dbh=DBI->connect("DBI:mysql:".$dbname,$dbuser,$dbpass) or exit 1;
$dbh->do("drop table jconf");
$dbh->do(
"create table jconf(jconf_id varchar(10) primary key,".
"jconf_value integer not null)");
$dbh->do("insert into jconf(jconf_id,jconf_value) values('jonp',30)");
$dbh->do("insert into jconf(jconf_id,jconf_value) values('per',24)");
$dbh->do("drop table jip");
$dbh->do(
"create table jip(jip_id varchar(20) primary key,".
"jip_time integer not null)");
$dbh->do("drop table jcat");
$dbh->do(
"create table jcat(jcat_id integer not null auto_increment primary key,".
"jcat_name varchar(40) not null)");
$dbh->do("drop table joke");
$dbh->do(
"create table joke(joke_id integer not null auto_increment primary key,".
"jcat_id integer not null,".
"joke_caption varchar(100),".
"joke_body text,".
"joke_sname varchar(100),".
"joke_semail varchar(100),".
"joke_views integer,".
"joke_votes integer,".
"joke_sends integer,".
"joke_rating integer,".
"joke_rt float,".
"joke_added integer,".
"joke_approved integer)");
$dbh->disconnect;
I cannot run it so I am converting it over to sql and importing it in as a .sql file. I have made:
CREATE TABLE jcat (
jcat_id int(11) NOT NULL auto_increment,
jcat_name varchar(40) NOT NULL default '',
PRIMARY KEY (jcat_id)
) TYPE=MyISAM;
CREATE TABLE jconf (
jconf_id varchar(10) NOT NULL default '0',
jconf_value int(11) NOT NULL default '0',
PRIMARY KEY (jconf_id)
) TYPE=MyISAM;
INSERT INTO jconf VALUES ('jonp', 30);
INSERT INTO jconf VALUES ('per', 24);
CREATE TABLE jip (
jip_id varchar(20) NOT NULL default '0',
jip_time int(11) NOT NULL default '0',
PRIMARY KEY (jip_id)
) TYPE=MyISAM;
CREATE TABLE joke (
jcat_id integer not null,
joke_caption varchar(100),
joke_body text,
joke_sname varchar(100),
joke_semail varchar(100),
joke_views integer,
joke_votes integer,
joke_sends integer,
joke_rating integer,
joke_rt float,
joke_added integer,
joke_approved integer
)
They are not the same. I cannot get them to be the same. Can somebody help me. Thanks!
