Erreur Sql

Résolu/Fermé
kevin581 Messages postés 600 Date d'inscription mardi 20 juillet 2010 Statut Membre Dernière intervention 1 mars 2021 - 27 déc. 2013 à 00:45
 Utilisateur anonyme - 27 déc. 2013 à 11:24
Bonjour, j'ai prit un template pour faire un site seulement voilà, j'ai tout fait comme il fallait, config chmod en 777 et tout et tout, mais j'ai une erreur à install.php voici l'erreur :

No database selectedjob_banners_m drop at line 10

et voici le code de mon install.php :

<?

include("config.php");
$link = mysql_connect($dbServer, $dbuserName, $dbpassword)
or die("Could not connect: " . mysql_error());
mysql_select_db($dbName);


$q1 = "DROP TABLE IF EXISTS job_banners_m";
mysql_query($q1) or die(mysql_error()."job_banners_m drop at line ".__LINE__);

$q1 = "CREATE TABLE job_banners_m (
bc char(1) NOT NULL default '')";
mysql_query($q1) or die(mysql_error()."job_banners_m create at line ".__LINE__);

$q1 = "DROP TABLE IF EXISTS job_banners_t";
mysql_query($q1) or die(mysql_error()."job_banners_t drop at line ".__LINE__);

$q1 = "CREATE TABLE job_banners_t (
b_id varchar(10) NOT NULL default '',
fn varchar(100) NOT NULL default '',
burl varchar(100) NOT NULL default '',
alt varchar(255) default NULL)";
mysql_query($q1) or die(mysql_error()."job_banners_t create at line ".__LINE__);

$q1 = "DROP TABLE IF EXISTS admin";
mysql_query($q1) or die(mysql_error()."admin drop at line ".__LINE__);

$q1 = "CREATE TABLE admin (
username varchar(20) NOT NULL default '0',
password varchar(20) NULL default '',
PRIMARY KEY (username)
) TYPE=MyISAM";
mysql_query($q1) or die(mysql_error()." admin create at line ".__LINE__);

$q1 = "INSERT INTO admin VALUES ('admin', 'admin')";
mysql_query($q1) or die(mysql_error()."admin insert at line ". __LINE__);



$q1 = "DROP TABLE IF EXISTS comments";
mysql_query($q1) or die(mysql_error()."comments drop at line ".__LINE__);

$q1 = "CREATE TABLE comments (
commentsid bigint(15) unsigned NOT NULL auto_increment,
comment text,
photosid bigint(15) unsigned default NULL,
byusername varchar(12) default NULL,
approved char(1) default NULL,
postdate datetime default NULL,
PRIMARY KEY (commentsid)
) TYPE=MyISAM AUTO_INCREMENT=3";
mysql_query($q1) or die(mysql_error()."comments create at line ".__LINE__);


$q1 = "DROP TABLE IF EXISTS emailtemplates";
mysql_query($q1) or die(mysql_error()."emailtemplates drop at line ".__LINE__);

$q1 = "CREATE TABLE emailtemplates (
templatesid bigint(15) unsigned NOT NULL auto_increment,
template text,
usedfor varchar(30) default NULL,
PRIMARY KEY (templatesid)
) TYPE=MyISAM AUTO_INCREMENT=6";
mysql_query($q1) or die(mysql_error()."emailtemplates create at line ".__LINE__);

$q1 = "INSERT INTO emailtemplates VALUES (1, 'Your username and validation code as given below\r\nUsername:%username%\r\nPassword:%password%\r\nValidation Code:%validcode%\r\nRegards, \r\nSupport Team', 'EMAILVALIDATION')";
mysql_query($q1) or die(mysql_error()."emailtemp 1 insert at line ". __LINE__);

$q1 = "INSERT INTO emailtemplates VALUES (2, 'Your username and validation code as given below\r\nUsername:%username%\r\nPassword:%password%\r\nRegards,\r\nSupport Team', 'NEWMEMBER')";
mysql_query($q1) or die(mysql_error()."emailtemp 2 insert at line ". __LINE__);

$q1 = "INSERT INTO emailtemplates VALUES (3, 'Dear %toname%,\r\n%message%\r\nRegards,\r\n%fromname%', 'EMAILFRIEND')";
mysql_query($q1) or die(mysql_error()."emailtemp 3 insert at line ". __LINE__);

$q1 = "INSERT INTO emailtemplates VALUES (4, 'Hi,\r\n%username% has written a comment on your picture.\r\nRegards,\r\nSupport Team', 'NEWCOMMENT')";
mysql_query($q1) or die(mysql_error()."emailtemp 4 insert at line ". __LINE__);

$q1 = "INSERT INTO emailtemplates VALUES (5, 'Hi,\r\n%username% has sent you a message.\r\nRegards,\r\nSupport Team', 'NEWMESSAGE')";
mysql_query($q1) or die(mysql_error()."emailtemp 5 insert at line ". __LINE__);



$q1 = "DROP TABLE IF EXISTS members";
mysql_query($q1) or die(mysql_error()."members drop at line ".__LINE__);

$q1 = "CREATE TABLE members (
username varchar(12) NOT NULL default '0',
password varchar(12) default NULL,
email varchar(40) default NULL,
age int(10) default NULL,
gender char(2) default NULL,
about text,
city varchar(50) default NULL,
country varchar(100) default NULL,
joindate datetime default NULL,
msn varchar(50) default NULL,
active int(10) default NULL,
aol varchar(50) default NULL,
yahoo varchar(50) default NULL,
icq varchar(50) default NULL,
fname varchar(30) default NULL,
lname varchar(30) default NULL,
commentemail char(1) default NULL,
messageemail char(1) default NULL,
validcode varchar(20) default NULL,
PRIMARY KEY (username)
)TYPE=MyISAM ";
mysql_query($q1) or die(mysql_error()."members create at line ".__LINE__);


$q1 = "DROP TABLE IF EXISTS messages";
mysql_query($q1) or die(mysql_error()."messages drop at line ".__LINE__);

$q1 = "CREATE TABLE messages (
messagesid bigint(15) unsigned NOT NULL auto_increment,
message text,
fromusername varchar(12) default NULL,
tousername varchar(12) default NULL,
upldate datetime default NULL,
seen char(1) default 'N',
subject varchar(100) default NULL,
PRIMARY KEY (messagesid)
) TYPE=MyISAM AUTO_INCREMENT=2";
mysql_query($q1) or die(mysql_error()."messages create at line ".__LINE__);


$q1 = "DROP TABLE IF EXISTS photos";
mysql_query($q1) or die(mysql_error()."photos drop at line ".__LINE__);

$q1 = "CREATE TABLE photos (
photosid bigint(15) unsigned NOT NULL auto_increment,
url varchar(100) default NULL,
filename varchar(40) default NULL,
username varchar(12) default NULL,
upldate datetime default NULL,
approved char(1) default NULL,
PRIMARY KEY (photosid)
) TYPE=MyISAM AUTO_INCREMENT=17";
mysql_query($q1) or die(mysql_error()."photos create at line ".__LINE__);

$q1 = "DROP TABLE IF EXISTS ratings";
mysql_query($q1) or die(mysql_error()."ratings drop at line ".__LINE__);

$q1 = "CREATE TABLE ratings (
ratingsid bigint(15) unsigned NOT NULL auto_increment,
numvotes int(10) unsigned default NULL,
totrating bigint(15) unsigned default NULL,
avgrating float default NULL,
photosid bigint(15) unsigned default NULL,
PRIMARY KEY (ratingsid)
) TYPE=MyISAM AUTO_INCREMENT=16";
mysql_query($q1) or die(mysql_error()."ratings create at line ".__LINE__);

$q1 = "DROP TABLE IF EXISTS settings";
mysql_query($q1) or die(mysql_error()."settings drop at line ".__LINE__);

$q1 = "CREATE TABLE settings (
setting varchar(30) NOT NULL default '0',
settingvalue varchar(100) default NULL,
PRIMARY KEY (setting)
) TYPE=MyISAM";
mysql_query($q1) or die(mysql_error()."settings create at line ".__LINE__);

$q1 = "INSERT INTO settings VALUES ('AUTOSIGNUP', 'N')";
mysql_query($q1) or die(mysql_error()."settings 1 insert at line ". __LINE__);

$q1 = "INSERT INTO settings VALUES ('MAXPICTURES', '5')";
mysql_query($q1) or die(mysql_error()."settings 2 insert at line ". __LINE__);

$q1 = "INSERT INTO settings VALUES ('APPROVEPIC', 'Y')";
mysql_query($q1) or die(mysql_error()."settings 3 insert at line ". __LINE__);

$q1 = "INSERT INTO settings VALUES ('THUMBHEIGHT', '100')";
mysql_query($q1) or die(mysql_error()."settings 4 insert at line ". __LINE__);

$q1 = "INSERT INTO settings VALUES ('THUMBWIDTH', '100')";
mysql_query($q1) or die(mysql_error()."settings 4 insert at line ". __LINE__);

$q1 = "INSERT INTO settings VALUES ('URLDOMAIN', 'http://www.mydomain.com')";
mysql_query($q1) or die(mysql_error()."settings 5 insert at line ". __LINE__);

$q1 = "INSERT INTO settings VALUES ('INBOXSIZE', '20')";
mysql_query($q1) or die(mysql_error()."settings 6 insert at line ". __LINE__);

$q1 = "INSERT INTO settings VALUES ('LATESTPICSIZE', '20')";
mysql_query($q1) or die(mysql_error()."settings 7 insert at line ". __LINE__);

$q1 = "INSERT INTO settings VALUES ('TOPRATEDSIZE', '20')";
mysql_query($q1) or die(mysql_error()."settings 8 insert at line ". __LINE__);

$q1 = "INSERT INTO settings VALUES ('SEARCHRESULTSIZE', '10')";
mysql_query($q1) or die(mysql_error()."settings 9 insert at line ". __LINE__);

$q1 = "INSERT INTO settings VALUES ('ADMINEMAIL', 'neo@cyberia.ca')";
mysql_query($q1) or die(mysql_error()."settings 10 insert at line ". __LINE__);

$q1 = "INSERT INTO settings VALUES ('APPROVECOMMENTS', 'Y')";
mysql_query($q1) or die(mysql_error()."settings 11 insert at line ". __LINE__);

$q1 = "INSERT INTO settings VALUES ('ALLOWEDFORMATS', '.jpg,.gif,.bmp')";
mysql_query($q1) or die(mysql_error()."settings 12 insert at line ". __LINE__);



echo "installation completed successfully!";

?>




1 réponse

Bonjour

Puisqu'il te dit qu'il n'y a pas de base de sélectionnée :
- vérifie le nom de ta base de données, celui contenu dans $dbName et le nom réel. La base dont le nom figure dans $dbName a-t-elle bien été créée ?
- modifie ta ligne de sélection pour afficher un message d'erreur :
mysql_select_db($dbName) or die(mysql_error());
0
kevin581 Messages postés 600 Date d'inscription mardi 20 juillet 2010 Statut Membre Dernière intervention 1 mars 2021 86
27 déc. 2013 à 10:26
Oui le nom de ma bdd existe et elle est créée :(
0
kevin581 Messages postés 600 Date d'inscription mardi 20 juillet 2010 Statut Membre Dernière intervention 1 mars 2021 86
27 déc. 2013 à 10:35
Probléme résolu j'avais écris : My_boostit au lieu de my_boostit :)
0
Utilisateur anonyme
27 déc. 2013 à 11:24
De rien
0