PDA

View Full Version : PHP Problem ;[



Tomm
23-04-2006, 03:13 PM
Hi,

It worked fine when I tested it on localhost but when I tested it on my server it dident create the tables or give a error message:


<?php include('../Connections/MySQL.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<p>SQL Creation...<br />
<?php
$filename = "install.lck";
if (file_exists($filename)) {
echo "ERROR: CANNOT INSTALL. THIS SETUP SCRIPT HAS RUN BEFORE!!!";
} else {
echo "Selecting DB...";
mysql_select_db($database_mysql, $mysql);
echo "OK <br />";
echo "Making Table Alert...";
mysql_query("CREATE TABLE `alert` (
`ID` int(4) NOT NULL auto_increment,
`message` text NOT NULL,
`active` char(1) NOT NULL default '',
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;");
echo "OK <br />";
echo "Making Table Config...";
mysql_query("CREATE TABLE `config` (
`id` int(10) NOT NULL auto_increment,
`name` longtext NOT NULL,
`value` longtext NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;");
echo "OK <br />";
echo "Inserting Default Values into config...";
mysql_query("INSERT INTO `config` VALUES (1, 'adminmsg', 'Default Message, please edit.');
INSERT INTO `config` VALUES (2, 'djsays', 'DJ SAYS DEFAULT');");
echo "OK <br />";
echo "Making Table Requests...";
mysql_query("CREATE TABLE `requests` (
`id` int(10) NOT NULL auto_increment,
`name` longtext NOT NULL,
`type` longtext NOT NULL,
`msg` longtext NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;");
echo "OK <br />";
echo "Making Table tmtbl...";
mysql_query("CREATE TABLE `tmtbl` (
`id` int(10) NOT NULL auto_increment,
`day` longtext NOT NULL,
`time` longtext NOT NULL,
`dj` longtext NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=169 ;");
echo "OK <br />";
echo "Inserting Values into tmtbl...";
mysql_query("INSERT INTO `tmtbl` VALUES (1, 'monday', '0:00 - 1:00', '');
INSERT INTO `tmtbl` VALUES (2, 'monday', '1:00 - 2:00', '');
INSERT INTO `tmtbl` VALUES (3, 'monday', '2:00 - 3:00', '');
INSERT INTO `tmtbl` VALUES (4, 'monday', '3:00 - 4:00', '');
INSERT INTO `tmtbl` VALUES (5, 'monday', '4:00 - 5:00', '');
INSERT INTO `tmtbl` VALUES (6, 'monday', '5:00 - 6:00', '');
INSERT INTO `tmtbl` VALUES (7, 'monday', '6:00 - 7:00', '');
INSERT INTO `tmtbl` VALUES (8, 'monday', '7:00 - 8:00', '');
INSERT INTO `tmtbl` VALUES (9, 'monday', '8:00 - 9:00', '');
INSERT INTO `tmtbl` VALUES (10, 'monday', '9:00 - 10:00', '');
INSERT INTO `tmtbl` VALUES (11, 'monday', '10:00 - 11:00', '');
INSERT INTO `tmtbl` VALUES (12, 'monday', '11:00 - 12:00', '');
INSERT INTO `tmtbl` VALUES (13, 'monday', '12:00 - 13:00', '');
INSERT INTO `tmtbl` VALUES (14, 'monday', '13:00 - 14:00', '');
INSERT INTO `tmtbl` VALUES (15, 'monday', '14:00 - 15:00', '');
INSERT INTO `tmtbl` VALUES (16, 'monday', '15:00 - 16:00', '');
INSERT INTO `tmtbl` VALUES (17, 'monday', '16:00 - 17:00', '');
INSERT INTO `tmtbl` VALUES (18, 'monday', '17:00 - 18:00', '');
INSERT INTO `tmtbl` VALUES (19, 'monday', '18:00 - 19:00', '');
INSERT INTO `tmtbl` VALUES (20, 'monday', '19:00 - 20:00', '');
INSERT INTO `tmtbl` VALUES (21, 'monday', '20:00 - 21:00', '');
INSERT INTO `tmtbl` VALUES (22, 'monday', '21:00 - 22:00', '');
INSERT INTO `tmtbl` VALUES (23, 'monday', '22:00 - 23:00', '');
INSERT INTO `tmtbl` VALUES (24, 'monday', '23:00 - 0:00', '');
INSERT INTO `tmtbl` VALUES (25, 'tuesday', '0:00 - 1:00', '');
INSERT INTO `tmtbl` VALUES (26, 'tuesday', '1:00 - 2:00', '');
INSERT INTO `tmtbl` VALUES (27, 'tuesday', '2:00 - 3:00', '');
INSERT INTO `tmtbl` VALUES (28, 'tuesday', '3:00 - 4:00', '');
INSERT INTO `tmtbl` VALUES (29, 'tuesday', '4:00 - 5:00', '');
INSERT INTO `tmtbl` VALUES (30, 'tuesday', '5:00 - 6:00', '');
INSERT INTO `tmtbl` VALUES (31, 'tuesday', '6:00 - 7:00', '');
INSERT INTO `tmtbl` VALUES (32, 'tuesday', '7:00 - 8:00', '');
INSERT INTO `tmtbl` VALUES (33, 'tuesday', '8:00 - 9:00', '');
INSERT INTO `tmtbl` VALUES (34, 'tuesday', '9:00 - 10:00', '');
INSERT INTO `tmtbl` VALUES (35, 'tuesday', '10:00 - 11:00', '');
INSERT INTO `tmtbl` VALUES (36, 'tuesday', '11:00 - 12:00', '');
INSERT INTO `tmtbl` VALUES (37, 'tuesday', '12:00 - 13:00', '');
INSERT INTO `tmtbl` VALUES (38, 'tuesday', '13:00 - 14:00', '');
INSERT INTO `tmtbl` VALUES (39, 'tuesday', '14:00 - 15:00', '');
INSERT INTO `tmtbl` VALUES (40, 'tuesday', '15:00 - 16:00', '');
INSERT INTO `tmtbl` VALUES (41, 'tuesday', '16:00 - 17:00', '');
INSERT INTO `tmtbl` VALUES (42, 'tuesday', '17:00 - 18:00', '');
INSERT INTO `tmtbl` VALUES (43, 'tuesday', '18:00 - 19:00', '');
INSERT INTO `tmtbl` VALUES (44, 'tuesday', '19:00 - 20:00', '');
INSERT INTO `tmtbl` VALUES (45, 'tuesday', '20:00 - 21:00', '');
INSERT INTO `tmtbl` VALUES (46, 'tuesday', '21:00 - 22:00', '');
INSERT INTO `tmtbl` VALUES (47, 'tuesday', '22:00 - 23:00', '');
INSERT INTO `tmtbl` VALUES (48, 'tuesday', '23:00 - 0:00', '');
INSERT INTO `tmtbl` VALUES (49, 'wednesday', '0:00 - 1:00', '');
INSERT INTO `tmtbl` VALUES (50, 'wednesday', '1:00 - 2:00', '');
INSERT INTO `tmtbl` VALUES (51, 'wednesday', '2:00 - 3:00', '');
INSERT INTO `tmtbl` VALUES (52, 'wednesday', '3:00 - 4:00', '');
INSERT INTO `tmtbl` VALUES (53, 'wednesday', '4:00 - 5:00', '');
INSERT INTO `tmtbl` VALUES (54, 'wednesday', '5:00 - 6:00', '');
INSERT INTO `tmtbl` VALUES (55, 'wednesday', '6:00 - 7:00', '');
INSERT INTO `tmtbl` VALUES (56, 'wednesday', '7:00 - 8:00', '');
INSERT INTO `tmtbl` VALUES (57, 'wednesday', '8:00 - 9:00', '');
INSERT INTO `tmtbl` VALUES (58, 'wednesday', '9:00 - 10:00', '');
INSERT INTO `tmtbl` VALUES (59, 'wednesday', '10:00 - 11:00', '');
INSERT INTO `tmtbl` VALUES (60, 'wednesday', '11:00 - 12:00', '');
INSERT INTO `tmtbl` VALUES (61, 'wednesday', '12:00 - 13:00', '');
INSERT INTO `tmtbl` VALUES (62, 'wednesday', '13:00 - 14:00', '');
INSERT INTO `tmtbl` VALUES (63, 'wednesday', '14:00 - 15:00', '');
INSERT INTO `tmtbl` VALUES (64, 'wednesday', '15:00 - 16:00', '');
INSERT INTO `tmtbl` VALUES (65, 'wednesday', '16:00 - 17:00', '');
INSERT INTO `tmtbl` VALUES (66, 'wednesday', '17:00 - 18:00', '');
INSERT INTO `tmtbl` VALUES (67, 'wednesday', '18:00 - 19:00', '');
INSERT INTO `tmtbl` VALUES (68, 'wednesday', '19:00 - 20:00', '');
INSERT INTO `tmtbl` VALUES (69, 'wednesday', '20:00 - 21:00', '');
INSERT INTO `tmtbl` VALUES (70, 'wednesday', '21:00 - 22:00', '');
INSERT INTO `tmtbl` VALUES (71, 'wednesday', '22:00 - 23:00', '');
INSERT INTO `tmtbl` VALUES (72, 'wednesday', '23:00 - 0:00', '');
INSERT INTO `tmtbl` VALUES (73, 'thursday', '0:00 - 1:00', '');
INSERT INTO `tmtbl` VALUES (74, 'thursday', '1:00 - 2:00', '');
INSERT INTO `tmtbl` VALUES (75, 'thursday', '2:00 - 3:00', '');
INSERT INTO `tmtbl` VALUES (76, 'thursday', '3:00 - 4:00', '');
INSERT INTO `tmtbl` VALUES (77, 'thursday', '4:00 - 5:00', '');
INSERT INTO `tmtbl` VALUES (78, 'thursday', '5:00 - 6:00', '');
INSERT INTO `tmtbl` VALUES (79, 'thursday', '6:00 - 7:00', '');
INSERT INTO `tmtbl` VALUES (80, 'thursday', '7:00 - 8:00', '');
INSERT INTO `tmtbl` VALUES (81, 'thursday', '8:00 - 9:00', '');
INSERT INTO `tmtbl` VALUES (82, 'thursday', '9:00 - 10:00', '');
INSERT INTO `tmtbl` VALUES (83, 'thursday', '10:00 - 11:00', '');
INSERT INTO `tmtbl` VALUES (84, 'thursday', '11:00 - 12:00', '');
INSERT INTO `tmtbl` VALUES (85, 'thursday', '12:00 - 13:00', '');
INSERT INTO `tmtbl` VALUES (86, 'thursday', '13:00 - 14:00', '');
INSERT INTO `tmtbl` VALUES (87, 'thursday', '14:00 - 15:00', '');
INSERT INTO `tmtbl` VALUES (88, 'thursday', '15:00 - 16:00', '');
INSERT INTO `tmtbl` VALUES (89, 'thursday', '16:00 - 17:00', '');
INSERT INTO `tmtbl` VALUES (90, 'thursday', '17:00 - 18:00', '');
INSERT INTO `tmtbl` VALUES (91, 'thursday', '18:00 - 19:00', '');
INSERT INTO `tmtbl` VALUES (92, 'thursday', '19:00 - 20:00', '');
INSERT INTO `tmtbl` VALUES (93, 'thursday', '20:00 - 21:00', '');
INSERT INTO `tmtbl` VALUES (94, 'thursday', '21:00 - 22:00', '');
INSERT INTO `tmtbl` VALUES (95, 'thursday', '22:00 - 23:00', '');
INSERT INTO `tmtbl` VALUES (96, 'thursday', '23:00 - 0:00', '');
INSERT INTO `tmtbl` VALUES (97, 'friday', '0:00 - 1:00', '');
INSERT INTO `tmtbl` VALUES (98, 'friday', '1:00 - 2:00', '');
INSERT INTO `tmtbl` VALUES (99, 'friday', '2:00 - 3:00', '');
INSERT INTO `tmtbl` VALUES (100, 'friday', '3:00 - 4:00', '');
INSERT INTO `tmtbl` VALUES (101, 'friday', '4:00 - 5:00', '');
INSERT INTO `tmtbl` VALUES (102, 'friday', '5:00 - 6:00', '');
INSERT INTO `tmtbl` VALUES (103, 'friday', '6:00 - 7:00', '');
INSERT INTO `tmtbl` VALUES (104, 'friday', '7:00 - 8:00', '');
INSERT INTO `tmtbl` VALUES (105, 'friday', '8:00 - 9:00', '');
INSERT INTO `tmtbl` VALUES (106, 'friday', '9:00 - 10:00', '');
INSERT INTO `tmtbl` VALUES (107, 'friday', '10:00 - 11:00', '');
INSERT INTO `tmtbl` VALUES (108, 'friday', '11:00 - 12:00', '');
INSERT INTO `tmtbl` VALUES (109, 'friday', '12:00 - 13:00', '');
INSERT INTO `tmtbl` VALUES (110, 'friday', '13:00 - 14:00', '');
INSERT INTO `tmtbl` VALUES (111, 'friday', '14:00 - 15:00', '');
INSERT INTO `tmtbl` VALUES (112, 'friday', '15:00 - 16:00', '');
INSERT INTO `tmtbl` VALUES (113, 'friday', '16:00 - 17:00', '');
INSERT INTO `tmtbl` VALUES (114, 'friday', '17:00 - 18:00', '');
INSERT INTO `tmtbl` VALUES (115, 'friday', '18:00 - 19:00', '');
INSERT INTO `tmtbl` VALUES (116, 'friday', '19:00 - 20:00', '');
INSERT INTO `tmtbl` VALUES (117, 'friday', '20:00 - 21:00', '');
INSERT INTO `tmtbl` VALUES (118, 'friday', '21:00 - 22:00', '');
INSERT INTO `tmtbl` VALUES (119, 'friday', '22:00 - 23:00', '');
INSERT INTO `tmtbl` VALUES (120, 'friday', '23:00 - 0:00', '');
INSERT INTO `tmtbl` VALUES (121, 'saturday', '0:00 - 1:00', '');
INSERT INTO `tmtbl` VALUES (122, 'saturday', '1:00 - 2:00', '');
INSERT INTO `tmtbl` VALUES (123, 'saturday', '2:00 - 3:00', '');
INSERT INTO `tmtbl` VALUES (124, 'saturday', '3:00 - 4:00', '');
INSERT INTO `tmtbl` VALUES (125, 'saturday', '4:00 - 5:00', '');
INSERT INTO `tmtbl` VALUES (126, 'saturday', '5:00 - 6:00', '');
INSERT INTO `tmtbl` VALUES (127, 'saturday', '6:00 - 7:00', '');
INSERT INTO `tmtbl` VALUES (128, 'saturday', '7:00 - 8:00', '');
INSERT INTO `tmtbl` VALUES (129, 'saturday', '8:00 - 9:00', '');
INSERT INTO `tmtbl` VALUES (130, 'saturday', '9:00 - 10:00', '');
INSERT INTO `tmtbl` VALUES (131, 'saturday', '10:00 - 11:00', '');
INSERT INTO `tmtbl` VALUES (132, 'saturday', '11:00 - 12:00', '');
INSERT INTO `tmtbl` VALUES (133, 'saturday', '12:00 - 13:00', '');
INSERT INTO `tmtbl` VALUES (134, 'saturday', '13:00 - 14:00', '');
INSERT INTO `tmtbl` VALUES (135, 'saturday', '14:00 - 15:00', '');
INSERT INTO `tmtbl` VALUES (136, 'saturday', '15:00 - 16:00', '');
INSERT INTO `tmtbl` VALUES (137, 'saturday', '16:00 - 17:00', '');
INSERT INTO `tmtbl` VALUES (138, 'saturday', '17:00 - 18:00', '');
INSERT INTO `tmtbl` VALUES (139, 'saturday', '18:00 - 19:00', '');
INSERT INTO `tmtbl` VALUES (140, 'saturday', '19:00 - 20:00', '');
INSERT INTO `tmtbl` VALUES (141, 'saturday', '20:00 - 21:00', '');
INSERT INTO `tmtbl` VALUES (142, 'saturday', '21:00 - 22:00', '');
INSERT INTO `tmtbl` VALUES (143, 'saturday', '22:00 - 23:00', '');
INSERT INTO `tmtbl` VALUES (144, 'saturday', '23:00 - 0:00', '');
INSERT INTO `tmtbl` VALUES (145, 'sunday', '0:00 - 1:00', '');
INSERT INTO `tmtbl` VALUES (146, 'sunday', '1:00 - 2:00', '');
INSERT INTO `tmtbl` VALUES (147, 'sunday', '2:00 - 3:00', '');
INSERT INTO `tmtbl` VALUES (148, 'sunday', '3:00 - 4:00', '');
INSERT INTO `tmtbl` VALUES (149, 'sunday', '4:00 - 5:00', '');
INSERT INTO `tmtbl` VALUES (150, 'sunday', '5:00 - 6:00', '');
INSERT INTO `tmtbl` VALUES (151, 'sunday', '6:00 - 7:00', '');
INSERT INTO `tmtbl` VALUES (152, 'sunday', '7:00 - 8:00', '');
INSERT INTO `tmtbl` VALUES (153, 'sunday', '8:00 - 9:00', '');
INSERT INTO `tmtbl` VALUES (154, 'sunday', '9:00 - 10:00', '');
INSERT INTO `tmtbl` VALUES (155, 'sunday', '10:00 - 11:00', '');
INSERT INTO `tmtbl` VALUES (156, 'sunday', '11:00 - 12:00', '');
INSERT INTO `tmtbl` VALUES (157, 'sunday', '12:00 - 13:00', '');
INSERT INTO `tmtbl` VALUES (158, 'sunday', '13:00 - 14:00', '');
INSERT INTO `tmtbl` VALUES (159, 'sunday', '14:00 - 15:00', '');
INSERT INTO `tmtbl` VALUES (160, 'sunday', '15:00 - 16:00', '');
INSERT INTO `tmtbl` VALUES (161, 'sunday', '16:00 - 17:00', '');
INSERT INTO `tmtbl` VALUES (162, 'sunday', '17:00 - 18:00', '');
INSERT INTO `tmtbl` VALUES (163, 'sunday', '18:00 - 19:00', '');
INSERT INTO `tmtbl` VALUES (164, 'sunday', '19:00 - 20:00', '');
INSERT INTO `tmtbl` VALUES (165, 'sunday', '20:00 - 21:00', '');
INSERT INTO `tmtbl` VALUES (166, 'sunday', '21:00 - 22:00', '');
INSERT INTO `tmtbl` VALUES (167, 'sunday', '22:00 - 23:00', '');
INSERT INTO `tmtbl` VALUES (168, 'sunday', '23:00 - 0:00', '');
");
echo "OK <br />";
echo "Making Table users...";
mysql_query("CREATE TABLE `users` (
`id` int(10) NOT NULL auto_increment,
`username` longtext NOT NULL,
`password` longtext NOT NULL,
`email` longtext NOT NULL,
`permission` longtext NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;");
echo "OK <br />";
echo "Inserting Default Values into users...";
mysql_query("INSERT INTO `users` VALUES (1, 'admin', 'admin', '[email protected]', 'admin');");
echo "OK <br />";
echo "Install Complete... Please edit config.php and you are ready to go!! If you need to reinstall for any reason please delete install.lck from the install directory.";
$file = 'install.txt';
$newfile = 'install.lck';

if (!rename("install.txt", "install.lck")) {
echo "failed to copy installer lock file. We recomend you rename install.l to install.lck to prevent this file from being able to run.";
}

}
?>
</p>
</body>
</html>

Mentor
23-04-2006, 03:18 PM
Check the server is useing the same version of mysql as your testing server. I had a big problem when trying to import one of mine from my host to my testing server, althogh i fixed it buy getting phpmyadmin to genoirate the code in copatablty mode with my mysql version "/

I duno if that would help. but it could be something to do with that, since the diffences in formating end up causieng errors, when its run

-JT-
23-04-2006, 06:34 PM
<html xmlns="http://www.w3.org/1999/xhtml">

Remove that line of code and try it.

if not What exactly is the error your getting?

Arisham
23-04-2006, 09:26 PM
What is the error message you are getting? or is it not creating the tables?

-JT-
23-04-2006, 09:28 PM
i dont think PHP scripts are meanto create tables :s

Dentafrice1
23-04-2006, 09:29 PM
Yea they are thats why they have install.php files :p

T0X!C-uk
23-04-2006, 09:29 PM
i think i have spotted the problem

check this line:

<?php include('../Connections/MySQL.php'); ?>

This my be trying to find theMySQL.php file from you computer try uploading the file to the public_html file on your hosting account and chaging the above line to.

<? include ("MySQL.php"); ?>

-JT-
23-04-2006, 09:30 PM
yeah but that doesnt look like an install file. If it is, he should just scrap the code and create the tables + do the config himselelf

T0X!C-uk
23-04-2006, 09:33 PM
yeah but that doesnt look like an install file. If it is, he should just scrap the code and create the tables + do the config himselelf

Yeah the coding does eem a bit wierd to be an install file...Usally they just conntent to the database and execute the sql within the install file

nets
23-04-2006, 09:40 PM
Remove that line of code and try it.

if not What exactly is the error your getting?
And that will help him how?

Dentafrice1
23-04-2006, 09:43 PM
Lmao thats what im thinking :p

Arisham
23-04-2006, 09:46 PM
Nothing looks wrong with the code, apart from the continous mysql_query

<?php include('../Connections/MySQL.php'); ?>
That is not the problem. That is just saying include a certain file.

Edit: I have noticed that you haven't defined these variables: $mysql, $database_mysql

nets
23-04-2006, 09:49 PM
Perhaps they're in the MySQL.php?
Anyway, use require rather than include.

Arisham
23-04-2006, 09:55 PM
I was thinking that. Then again, it might not be.

CHECK YOUR MYSQL.PHP FILLLLLLEELELELLELE!

Mentor
23-04-2006, 11:18 PM
it is quite hard to say what the error is with without knowing the error message "/

Tomm
24-04-2006, 02:56 PM
Right ok :P The ../Connection/MySQL.php include and file is fine. There is NO, I repeat NO error message, it just dosent create the tables.

Basicly heres my folder/file tree:

-Connections
--MySQL.php
-Install
--install2.php (This is the file being used to run the SQL)

Edit: Also do you really think I am that dumb to use file paths on my computer not file paths on the target server ''/

Also heres my MySQL.php file:


<?php
$hostname_mysql = "localhost";
$database_mysql = "radio2";
$username_mysql = "root";
$password_mysql = "";
$mysql = mysql_pconnect($hostname_mysql, $username_mysql, $password_mysql) or trigger_error(mysql_error(),E_USER_ERROR);
?>
The username, passwords, and db are ok.

Sygon.
24-04-2006, 03:28 PM
:D I wouldnt use .../ id use / thats just moi and im learning

Tomm
24-04-2006, 03:37 PM
:D I wouldnt use .../ id use / thats just moi and im learning

No because the Connections folder it not in the install folder is it now?

Anyway I think I fixed the problem. I used a diffrent type of table on my local (Testing) MySQL server than on my deployment server.

Arisham
24-04-2006, 06:22 PM
Org, did you add the correct prefix to the tables?

eg: I own habbotoday.net, and it would be:

habtoday_admin (for username)
did you remember to add the prefix (yoursite_)?

Mentor
24-04-2006, 06:34 PM
No because the Connections folder it not in the install folder is it now?

Anyway I think I fixed the problem. I used a diffrent type of table on my local (Testing) MySQL server than on my deployment server.
Yay my orignal thought was correctomondo then :D

-JT-
25-04-2006, 06:50 AM
And that will help him how?

When i used dreamweaver, that line of code stopped so many PHP tasks frome executing.

Want to hide these adverts? Register an account for free!