Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Problem with Creating MySql tables with php.

Avatar of patrik20
patrik20 asked on
PHP
24 Comments1 Solution223 ViewsLast Modified:
Hi

I try to create some tables with this script but I get the message: “error creating ecards table” ($result1 in the code) . Can you please tell me how make it to work?

<HTML>
<BODY>
<?
include ("serverdata.php");

$con = mysql_connect($dbHost,$dbUser,$dbPass);
mysql_select_db($dbName, $con);
$query1="
CREATE TABLE ecards (
  crd_key int(6) NOT NULL auto_increment,
  crd_name varchar(25) NOT NULL default '',
  crd_thumb blob,
  crd_date date NOT NULL default '0000-00-00',
  PRIMARY KEY  (crd_key)
) TYPE=MyISAM;";

$query2="
CREATE TABLE ecards_categories (
  rub_key int(11) NOT NULL auto_increment,
  rub_grp int(11) NOT NULL default '0',
  rub_naam varchar(50) default NULL,
  KEY rub_naam (rub_naam)
) TYPE=MyISAM;";

$query3="INSERT INTO ecards_categories VALUES (1, 0, 'HOME');";

$query4="
CREATE TABLE ecards_config (
  cfg_id int(11) NOT NULL auto_increment,
  cfg_username varchar(20) NOT NULL default '',
  cfg_password varchar(20) NOT NULL default '',
  cfg_language varchar(30) NOT NULL default '',
  cfg_bgcolor varchar(7) NOT NULL default '',
  PRIMARY KEY  (cfg_id)
) TYPE=MyISAM;";

$query5="INSERT INTO ecards_config VALUES (1, 'admin', 'admin', 'english.php', '#FFFFFF');";

$query6="
CREATE TABLE ecards_send (
  snd_id int(11) NOT NULL auto_increment,
  snd_key varchar(14) default NULL,
  snd_date date NOT NULL default '0000-00-00',
  snd_read char(1) NOT NULL default '',
  PRIMARY KEY  (snd_id),
  UNIQUE KEY snd_key (snd_key)
) TYPE=MyISAM;";

$result1 = mysql_db_query($database,$query1) or die('error creating ecards table');
$result2 = mysql_db_query($database,$query2) or die('error creating ecards_categories table');
$result3 = mysql_db_query($database,$query3) or die('error inserting home categorie');
$result4 = mysql_db_query($database,$query4) or die('error creating ecards_config table');
$result5 = mysql_db_query($database,$query5) or die('error inserting in ecards_config table');
$result6 = mysql_db_query($database,$query6) or die('error creating ecards_send table');

echo "<FONT SIZE=4><b>All tables created successfully</b></FONT><BR><BR>";
echo "Now you can proceed to setting up your ecards application<BR>";
echo "<A HREF=\"./admin/index.php\">Click here</A> to go to the settings page and login with username 'admin' and password 'admin'<BR>";
?>
</BODY>
</HTML>

ASKER CERTIFIED SOLUTION
Avatar of Joseph Melnick
Joseph MelnickFlag of Canada imageCore Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 24 Comments.
See Answers