hpnn.wm
December 9th, 2012, 22:17
دوستان می خواهیم یک Table با توجه به مشخصات زیر در یک دیتابیس ایجاد کنیم
البته من این رو از یک فایل PHP برداشتم ولی متاسفانه هنگام اجرا Table ها ایجاد نمی شند
به همین دلیل می خوام به صورت دستی این کار رو انجام بدم
لطف کنید من رو در این ضمینه راهنمایی بفرمایید
mysql_query("CREATE TABLE user (
id tinyint(4) NOT NULL auto_increment,
username text NOT NULL,
password text NOT NULL,
number text NOT NULL,
average text NOT NULL,
paye text NOT NULL,
name text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
البته لازم به ذکر است که کل اسکریپت PHP به صورت زیر هست
برای کسانی که اطلاعات بیشتر می خواهند :)
<?
// Programmer : FAMIZBAN.Com
include "include/config.php";
// --- \\ Install Databases // --- \\\
mysql_query("CREATE TABLE user (
id tinyint(4) NOT NULL auto_increment,
username text NOT NULL,
password text NOT NULL,
number text NOT NULL,
average text NOT NULL,
paye text NOT NULL,
name text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE maghale (
id tinyint(4) NOT NULL auto_increment,
title text NOT NULL,
catid text NOT NULL,
nevis text NOT NULL,
body text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE nomre (
id tinyint(4) NOT NULL auto_increment,
nomr text NOT NULL,
date text NOT NULL,
dars text NOT NULL,
magh text NOT NULL,
nesh text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE magh (
id tinyint(4) NOT NULL auto_increment,
name text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE cat (
id tinyint(4) NOT NULL auto_increment,
name text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE paye (
id tinyint(4) NOT NULL auto_increment,
name text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE stat (
id tinyint(4) NOT NULL auto_increment,
tvisit text NOT NULL,
yvisit text NOT NULL,
avisit text NOT NULL,
cash text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE matn (
id tinyint(4) NOT NULL auto_increment,
title text NOT NULL,
body text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE azmoon (
id tinyint(4) NOT NULL auto_increment,
name text NOT NULL,
tedad text NOT NULL,
pors text NOT NULL,
paso text NOT NULL,
java text NOT NULL,
paye text NOT NULL,
dars text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE natije (
id tinyint(4) NOT NULL auto_increment,
name text NOT NULL,
paye text NOT NULL,
dars text NOT NULL,
azmo text NOT NULL,
idaz text NOT NULL,
nati text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE tut (
id tinyint(4) NOT NULL auto_increment,
title text NOT NULL,
body text NOT NULL,
dars text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE amoozgar (
id tinyint(4) NOT NULL auto_increment,
name text NOT NULL,
tozi text NOT NULL,
imag text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE news (
id tinyint(4) NOT NULL auto_increment,
title text NOT NULL,
date text NOT NULL,
matn text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE about (
id tinyint(4) NOT NULL auto_increment,
work text NOT NULL,
matn text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
$date = date("d");
mysql_query("INSERT INTO `stat` VALUES (1, '0', '0', '0', '$date');");
mysql_query("INSERT INTO matn (id,title,body ) VALUES ('1','index','Home Text' )");
mysql_query("INSERT INTO matn (id,title,body ) VALUES ('2','contact','contact Text' )");
mysql_query("INSERT INTO matn (id,title,body ) VALUES ('3','term','term Text' )");
mysql_query("INSERT INTO about (id,work,matn ) VALUES ('1','darbare','Darbare Text' )");
mysql_query("INSERT INTO about (id,work,matn ) VALUES ('2','emkanat','emkanat Text' )");
mysql_query("INSERT INTO about (id,work,matn ) VALUES ('3','contact','Tamas Text' )");
?>
البته من این رو از یک فایل PHP برداشتم ولی متاسفانه هنگام اجرا Table ها ایجاد نمی شند
به همین دلیل می خوام به صورت دستی این کار رو انجام بدم
لطف کنید من رو در این ضمینه راهنمایی بفرمایید
mysql_query("CREATE TABLE user (
id tinyint(4) NOT NULL auto_increment,
username text NOT NULL,
password text NOT NULL,
number text NOT NULL,
average text NOT NULL,
paye text NOT NULL,
name text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
البته لازم به ذکر است که کل اسکریپت PHP به صورت زیر هست
برای کسانی که اطلاعات بیشتر می خواهند :)
<?
// Programmer : FAMIZBAN.Com
include "include/config.php";
// --- \\ Install Databases // --- \\\
mysql_query("CREATE TABLE user (
id tinyint(4) NOT NULL auto_increment,
username text NOT NULL,
password text NOT NULL,
number text NOT NULL,
average text NOT NULL,
paye text NOT NULL,
name text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE maghale (
id tinyint(4) NOT NULL auto_increment,
title text NOT NULL,
catid text NOT NULL,
nevis text NOT NULL,
body text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE nomre (
id tinyint(4) NOT NULL auto_increment,
nomr text NOT NULL,
date text NOT NULL,
dars text NOT NULL,
magh text NOT NULL,
nesh text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE magh (
id tinyint(4) NOT NULL auto_increment,
name text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE cat (
id tinyint(4) NOT NULL auto_increment,
name text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE paye (
id tinyint(4) NOT NULL auto_increment,
name text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE stat (
id tinyint(4) NOT NULL auto_increment,
tvisit text NOT NULL,
yvisit text NOT NULL,
avisit text NOT NULL,
cash text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE matn (
id tinyint(4) NOT NULL auto_increment,
title text NOT NULL,
body text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE azmoon (
id tinyint(4) NOT NULL auto_increment,
name text NOT NULL,
tedad text NOT NULL,
pors text NOT NULL,
paso text NOT NULL,
java text NOT NULL,
paye text NOT NULL,
dars text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE natije (
id tinyint(4) NOT NULL auto_increment,
name text NOT NULL,
paye text NOT NULL,
dars text NOT NULL,
azmo text NOT NULL,
idaz text NOT NULL,
nati text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE tut (
id tinyint(4) NOT NULL auto_increment,
title text NOT NULL,
body text NOT NULL,
dars text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE amoozgar (
id tinyint(4) NOT NULL auto_increment,
name text NOT NULL,
tozi text NOT NULL,
imag text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE news (
id tinyint(4) NOT NULL auto_increment,
title text NOT NULL,
date text NOT NULL,
matn text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
mysql_query("CREATE TABLE about (
id tinyint(4) NOT NULL auto_increment,
work text NOT NULL,
matn text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;");
$date = date("d");
mysql_query("INSERT INTO `stat` VALUES (1, '0', '0', '0', '$date');");
mysql_query("INSERT INTO matn (id,title,body ) VALUES ('1','index','Home Text' )");
mysql_query("INSERT INTO matn (id,title,body ) VALUES ('2','contact','contact Text' )");
mysql_query("INSERT INTO matn (id,title,body ) VALUES ('3','term','term Text' )");
mysql_query("INSERT INTO about (id,work,matn ) VALUES ('1','darbare','Darbare Text' )");
mysql_query("INSERT INTO about (id,work,matn ) VALUES ('2','emkanat','emkanat Text' )");
mysql_query("INSERT INTO about (id,work,matn ) VALUES ('3','contact','Tamas Text' )");
?>