04-01-2006
|
#1 (permalink)
|
|
Registered User
Join Date: May 2005
Location: England (South)
Posts: 40
|
PHP Install File
Hay im trying to code an install file for my forum system im coding with a freind. I get the following error however on the end of my code can some one please help me debug the error?
Quote:
|
Parse error: parse error, unexpected T_ELSEIF in /home/spaceco/public_html/nex-gen-bb/install/index.php on line 254
|
Code:
{
echo('We have made the cats table');
}
if(!$sqltable1 || !$sqltable2 || !$sqltable3 || !$sqltable4|| !$sqltable5 || !$sqltable6)
{
echo('Sorry, we have 1 or more errors, please see what is wrong');
}
}
else
{
echo('Success all tables have been made!');
}
mysql_close();
elseif($act == "6")
{
echo('Coming Soon');
}
?>
The code goes line to line from 240 to 260.
Thanks trev
__________________
Space Cowboy
Thanks for all the help here guys!
|
|
|
04-01-2006
|
#2 (permalink)
|
|
Recursively call who?
Join Date: Nov 2003
Location: Pittsburgh, PA
Posts: 294
|
Code:
if(!$sqltable1 || !$sqltable2 || !$sqltable3 || !$sqltable4|| !$sqltable5 || !$sqltable6)
{
echo('Sorry, we have 1 or more errors, please see what is wrong');
}
}<-----Extra brace
else
{
I think you have an extra closing brace before your else. I believe that would cause the error.
|
|
|
04-01-2006
|
#3 (permalink)
|
|
Registered User
Join Date: Mar 2006
Location: Comodoro Rivadavia, Chubut, ARgentina.
Posts: 22
|
paste all the code..
maybe the extra bracket is closing code from the top..
1) i see that theres is code between the if-else-elseif structure..
mysql_close(); <-- that code..
2) the last structre of the if-else-elseif is an else
else
{
echo('Success all tables have been made!');
}
so u cant put an elseif after an else..because the else close the structure
if (cond){}
elseif (cond) {} // optional
// more elseif() {} if u need it
else{} //closing the structure and is optional
sorry my english..i wish i could help you..
if u need more help..paste all the code..
|
|
|
04-01-2006
|
#4 (permalink)
|
|
Registered User
Join Date: May 2005
Location: England (South)
Posts: 40
|
If i remove the } i still get the same error.
Heres all the code
Code:
<?php
define('dabb', 1);
require_once('func.php');
require_once('mysql.php');
if(PHP_VERSION < '4.1.0')
{
$_GET = &$HTTP_GET_VARS;
$_POST = &$HTTP_POST_VARS;
$_COOKIE = &$HTTP_COOKIE_VARS;
$_SERVER = &$HTTP_SERVER_VARS;
$_FILES = &$HTTP_POST_FILES;
$_REQUEST = array_merge($_GET, $_POST, $_COOKIE);
}
$act = $_GET['act'];
if($act == "")
{
echo('
<html>
<head>
<title>Nex-Gen-BB Installer Script=Step 1</title>
</head>
<body>
<center><table border="0"><tr><td><img src="img/install_logo.png" alt="Logo" />
</td></tr><tr><td>Welcome Nex-Gen-BB Install File, Thanks For Choosing Nex-Gen BB For your Bulletin Board Needs <img src="img/smile.gif" alt=":)" /><br />
<form action="index.php?act=1" method="post"><input type="submit" value="Next Step"></form></td></tr></table>
</body>
</html>
');
}
elseif($act == "1")
{
if(!file_exists('./../setting.php'))
{
die('<title>Error</title><font color="red"><center><img src="img/install_logo.png"><br />Sorry, we could not find the setting.php file, please upload again.</font>');
}
elseif(!is_writable('./../setting.php'))
{
die('<title>Error</title><font color="red"><center><img src="img/install_logo.png"><br />Sorry, you need to CHMOD setting.php to 777</font>');
}
else
{
echo('<title>Success</title><font color="green"><center><img src="img/install_logo.png"><br />Success, you are ready for step 3!</font><br />
<form action="index.php?act=2" method="post"><input type="submit" value="Next Step"></form>');
}
}
elseif($act == "2")
{
$dataname = $_POST['dataname'];
echo('<title>MySQL and Board Settings</title><table align="center" border="0"><tr><td>
<img src="img/install_logo.png" /><br /><h4>Board and MySQL Settings</h4><br /><br />
<form action="index.php?act=3" method="post">
MySQL Server: <input type="text" name="server" size="30" value="localhost"> <b>Most of the Time localhost</b><br />
MySQL Database: <input type="text" name="database" size="30" value="'.$dbname.'"> <b>Enter Your MySQL Database here</b><br />
Username: <input type="text" name="username" size="30"> <b>Enter Your MySQL Username</b><br />
Password: <input type="password" name="pass" size="30"> <b>Enter Your MySQL Password</b><br /><br />
<input type="submit" value="Submit Info"></form>');
}
elseif($act == "3")
{
$server = $_POST['server'];
$database = $_POST['database'];
$username = $_POST['username'];
$pass = $_POST['pass'];
echo(installcheck1($server, $database, $username, $pass));
echo('<form action="index.php?act=4" method="post">
<input type="submit" value="Go Onto Writing and Testing MySQL"></form> ');
}
elseif($act == "4")
{
echo('Trying to Connect To The Database with that info.....');
$sqlconnect = @mysql_connect($server, $username, $pass);
if(!$sqlconnect)
{
echo('<b>Trying to connect to the database server.............</b><br />ERROR!');
die();
}
else
{
echo('Trying to connect to the database server.............<br />Great');
}
$dbtest = @mysql_select_db($database);
if(!$dbtest)
{
echo('Trying to connect using the database you gave.... Error!');
die();
}
else
{
echo('Trying to connect using the database you gave.... Success!');
}
echo('Writing to settings.php Standby....');
$write = fopen("./../settings.php", "w");
fwrite($write, "<"."?php\n\n/
$server = \"$server\"; \n//
$db = \"$database\"; \n//
$user_db = \"$username\"; \n//
$pass_db = \"$pass\"; \n//
\n\n\n?".">\n");
echo('Closing Config.php');
fclose($write);
echo('Now that we have written the info too settings.php, we can now make the mysql tables<br ?><a href="/index.php?act=5>Go Onto Step 6</a>');
}
elseif($act == "5")
{
require_once('./../settings.php');
$sqltable1 = mysql_query("
CREATE TABLE
`nex_users`
(
`id` SMALLINT(5) NOT NULL AUTO_INCREMENT ,
`password` VARCHAR(75) NOT NULL ,
`email` VARCHAR(100) NOT NULL ,
`typeuser` INT(1) NOT NULL ,
`posts` INT(20) NOT NULL ,
`icq` VARCHAR(50) NOT NULL ,
`aim` VARCHAR(50) NOT NULL ,
`msn` VARCHAR(50) NOT NULL ,
`yim` VARCHAR(50) NOT NULL ,
`gtalk` VARCHAR(50) NOT NULL ,
PRIMARY KEY ( `id` )
)
TYPE = MYISAM");
if(!$sqltable1)
{
echo('We are now making the table nex_users, ERROR, we have encountered an error');
}
else
{
echo('We are now making the table nex_users, SUCCESS the table has been made');
}
$sqltable2 = mysql_query("
CREATE TABLE
`nex_forums`
`id` SMALLINT(5) NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(50) NOT NULL ,
`descript` VARCHAR(500) NOT NULL ,
`locked` VARCHAR(10) NOT NULL ,
`parentid` INT(50) NOT NULL ,
PRIMARY KEY ( `id` )
)
TYPE = MYISAM");
if(!$sqltable2)
{
echo('Nex_Forums table could not be created');
}
else
{
echo('Success! We mad the table nex_forums');
}
$sqltable3 = mysql_query("
CREATE TABLE
`nex_posts`
(
`id` SMALLINT(5) NOT NULL AUTO_INCREMENT ,
`forumid` INT(10) NOT NULL ,
`threadid` INT(20) NOT NULL ,
`name` VARCHAR(100) NOT NULL ,
`message` TEXT NOT NULL ,
`poster` VARCHAR(30) NOT NULL ,
PRIMARY KEY ( `id` )
)
TYPE = MYISAM");
if(!$sqltable3)
{
echo('We can not create the posts table!');
}
else
{
echo('Succes, the posts table has been made!');
}
$sqltable4 = mysql_query("
CREATE TABLE
`nex_thread`
(
`id` SMALLINT(5) NOT NULL AUTO_INCREMENT ,
`forumid` INT(10) NOT NULL ,
`name` VARCHAR(100) NOT NULL ,
`message` TEXT NOT NULL ,
`date` VARCHAR(100) NOT NULL ,
`poster` VARCHAR(30) NOT NULL ,
`locked` VARCHAR(10) NOT NULL ,
`sticky` VARCHAR(10) NOT NULL ,
PRIMARY KEY ( `id` )
)
TYPE = MYISAM");
if(!$sqltable4)
{
echo('Sorry, the threads table can not be made');
}
else
{
echo('The threads table has been made');
}
$sqltable5 = mysql_query("
CREATE TABLE
`nex_ses`
(
`userid` INT(20) NOT NULL ,
`ip` VARCHAR( 100 ) NOT NULL ,
`forumid` INT( 20 ) NOT NULL ,
`threadid` INT( 20 ) NOT NULL ,
PRIMARY KEY ( `ip` )
)
TYPE = MYISAM");
if(!$sqltable5)
{
echo('Sorry, we can not make the sessions table');
}
else
{
echo('We have made the sessions table');
}
$sqltable6 = mysql_query("
CREATE TABLE
`nex_cat`
(
`id` INT( 10 ) NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(75) NOT NULL ,
`descript` TEXT NOT NULL ,
`order` INT(10) NOT NULL ,
PRIMARY KEY ( `id` )
)
TYPE = MYISAM");
if(!$sqltable6)
{
echo('Sorry, we can not make the cat table');
}
else
{
echo('We have made the cats table');
}
if(!$sqltable1 || !$sqltable2 || !$sqltable3 || !$sqltable4|| !$sqltable5 || !$sqltable6)
{
echo('Sorry, we have 1 or more errors, please see what is wrong');
}
}
else
{
echo('Success all tables have been made!');
}
mysql_close();
elseif($act == "6")
{
echo('Coming Soon');
}
?>
__________________
Space Cowboy
Thanks for all the help here guys!
Last edited by Space Cowboy; 04-01-2006 at 10:57 AM..
|
|
|
04-02-2006
|
#5 (permalink)
|
|
Yup, that's meee!
Join Date: Jun 2004
Location: Infront of my screen (most of the time)
Posts: 89
|
Try it like this:
As Cr0w said, the elseif statement should be before the normal else statement.
PHP Code:
<?php
define('dabb', 1);
require_once('func.php');
require_once('mysql.php');
if(PHP_VERSION < '4.1.0')
{
$_GET = &$HTTP_GET_VARS;
$_POST = &$HTTP_POST_VARS;
$_COOKIE = &$HTTP_COOKIE_VARS;
$_SERVER = &$HTTP_SERVER_VARS;
$_FILES = &$HTTP_POST_FILES;
$_REQUEST = array_merge($_GET, $_POST, $_COOKIE);
}
$act = $_GET['act'];
if($act == "")
{
echo('
<html>
<head>
<title>Nex-Gen-BB Installer Script=Step 1</title>
</head>
<body>
<center><table border="0"><tr><td><img src="img/install_logo.png" alt="Logo" />
</td></tr><tr><td>Welcome Nex-Gen-BB Install File, Thanks For Choosing Nex-Gen BB For your Bulletin Board Needs <img src="img/smile.gif" alt=":)" /><br />
<form action="index.php?act=1" method="post"><input type="submit" value="Next Step"></form></td></tr></table>
</body>
</html>
');
}
elseif($act == "1")
{
if(!file_exists('./../setting.php'))
{
die('<title>Error</title><font color="red"><center><img src="img/install_logo.png"><br />Sorry, we could not find the setting.php file, please upload again.</font>');
}
elseif(!is_writable('./../setting.php'))
{
die('<title>Error</title><font color="red"><center><img src="img/install_logo.png"><br />Sorry, you need to CHMOD setting.php to 777</font>');
}
else
{
echo('<title>Success</title><font color="green"><center><img src="img/install_logo.png"><br />Success, you are ready for step 3!</font><br />
<form action="index.php?act=2" method="post"><input type="submit" value="Next Step"></form>');
}
}
elseif($act == "2")
{
$dataname = $_POST['dataname'];
echo('<title>MySQL and Board Settings</title><table align="center" border="0"><tr><td>
<img src="img/install_logo.png" /><br /><h4>Board and MySQL Settings</h4><br /><br />
<form action="index.php?act=3" method="post">
MySQL Server: <input type="text" name="server" size="30" value="localhost"> <b>Most of the Time localhost</b><br />
MySQL Database: <input type="text" name="database" size="30" value="'.$dbname.'"> <b>Enter Your MySQL Database here</b><br />
Username: <input type="text" name="username" size="30"> <b>Enter Your MySQL Username</b><br />
Password: <input type="password" name="pass" size="30"> <b>Enter Your MySQL Password</b><br /><br />
<input type="submit" value="Submit Info"></form>');
}
elseif($act == "3")
{
$server = $_POST['server'];
$database = $_POST['database'];
$username = $_POST['username'];
$pass = $_POST['pass'];
echo(installcheck1($server, $database, $username, $pass));
echo('<form action="index.php?act=4" method="post">
<input type="submit" value="Go Onto Writing and Testing MySQL"></form> ');
}
elseif($act == "4")
{
echo('Trying to Connect To The Database with that info.....');
$sqlconnect = @mysql_connect($server, $username, $pass);
if(!$sqlconnect)
{
echo('<b>Trying to connect to the database server.............</b><br />ERROR!');
die();
}
else
{
echo('Trying to connect to the database server.............<br />Great');
}
$dbtest = @mysql_select_db($database);
if(!$dbtest)
{
echo('Trying to connect using the database you gave.... Error!');
die();
}
else
{
echo('Trying to connect using the database you gave.... Success!');
}
echo('Writing to settings.php Standby....');
$write = fopen("./../settings.php", "w");
fwrite($write, "<"."?php\n\n/
$server = \"$server\"; \n//
$db = \"$database\"; \n//
$user_db = \"$username\"; \n//
$pass_db = \"$pass\"; \n//
\n\n\n?".">\n");
echo('Closing Config.php');
fclose($write);
echo('Now that we have written the info too settings.php, we can now make the mysql tables<br><a href="/index.php?act=5>Go Onto Step 6</a>');
}
elseif($act == "5")
{
require_once('./../settings.php');
$sqltable1 = mysql_query("
CREATE TABLE
`nex_users`
(
`id` SMALLINT(5) NOT NULL AUTO_INCREMENT ,
`password` VARCHAR(75) NOT NULL ,
`email` VARCHAR(100) NOT NULL ,
`typeuser` INT(1) NOT NULL ,
`posts` INT(20) NOT NULL ,
`icq` VARCHAR(50) NOT NULL ,
`aim` VARCHAR(50) NOT NULL ,
`msn` VARCHAR(50) NOT NULL ,
`yim` VARCHAR(50) NOT NULL ,
`gtalk` VARCHAR(50) NOT NULL ,
PRIMARY KEY ( `id` )
)
TYPE = MYISAM");
if(!$sqltable1)
{
echo('We are now making the table nex_users, ERROR, we have encountered an error');
}
else
{
echo('We are now making the table nex_users, SUCCESS the table has been made');
}
$sqltable2 = mysql_query("
CREATE TABLE
`nex_forums`
`id` SMALLINT(5) NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(50) NOT NULL ,
`descript` VARCHAR(500) NOT NULL ,
`locked` VARCHAR(10) NOT NULL ,
`parentid` INT(50) NOT NULL ,
PRIMARY KEY ( `id` )
)
TYPE = MYISAM");
if(!$sqltable2)
{
echo('Nex_Forums table could not be created');
}
else
{
echo('Success! We mad the table nex_forums');
}
$sqltable3 = mysql_query("
CREATE TABLE
`nex_posts`
(
`id` SMALLINT(5) NOT NULL AUTO_INCREMENT ,
`forumid` INT(10) NOT NULL ,
`threadid` INT(20) NOT NULL ,
`name` VARCHAR(100) NOT NULL ,
`message` TEXT NOT NULL ,
`poster` VARCHAR(30) NOT NULL ,
PRIMARY KEY ( `id` )
)
TYPE = MYISAM");
if(!$sqltable3)
{
echo('We can not create the posts table!');
}
else
{
echo('Succes, the posts table has been made!');
}
$sqltable4 = mysql_query("
CREATE TABLE
`nex_thread`
(
`id` SMALLINT(5) NOT NULL AUTO_INCREMENT ,
`forumid` INT(10) NOT NULL ,
`name` VARCHAR(100) NOT NULL ,
`message` TEXT NOT NULL ,
`date` VARCHAR(100) NOT NULL ,
`poster` VARCHAR(30) NOT NULL ,
`locked` VARCHAR(10) NOT NULL ,
`sticky` VARCHAR(10) NOT NULL ,
PRIMARY KEY ( `id` )
)
TYPE = MYISAM");
if(!$sqltable4)
{
echo('Sorry, the threads table can not be made');
}
else
{
echo('The threads table has been made');
}
$sqltable5 = mysql_query("
CREATE TABLE
`nex_ses`
(
`userid` INT(20) NOT NULL ,
`ip` VARCHAR( 100 ) NOT NULL ,
`forumid` INT( 20 ) NOT NULL ,
`threadid` INT( 20 ) NOT NULL ,
PRIMARY KEY ( `ip` )
)
TYPE = MYISAM");
if(!$sqltable5)
{
echo('Sorry, we can not make the sessions table');
}
else
{
echo('We have made the sessions table');
}
$sqltable6 = mysql_query("
CREATE TABLE
`nex_cat`
(
`id` INT( 10 ) NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(75) NOT NULL ,
`descript` TEXT NOT NULL ,
`order` INT(10) NOT NULL ,
PRIMARY KEY ( `id` )
)
TYPE = MYISAM");
if(!$sqltable6)
{
echo('Sorry, we can not make the cat table');
}
else
{
echo('We have made the cats table');
}
if(!$sqltable1 || !$sqltable2 || !$sqltable3 || !$sqltable4|| !$sqltable5 || !$sqltable6)
{
echo('Sorry, we have 1 or more errors, please see what is wrong');
}
}
elseif($act == "6")
{
echo('Coming Soon');
}
else
{
echo('Success all tables have been made!');
}
mysql_close();
?>
I hope this helps you
Quote:
|
Originally Posted by Space Cowboy
If i remove the } i still get the same error.
Heres all the code
Code:
<?php
define('dabb', 1);
require_once('func.php');
require_once('mysql.php');
if(PHP_VERSION < '4.1.0')
{
$_GET = &$HTTP_GET_VARS;
$_POST = &$HTTP_POST_VARS;
$_COOKIE = &$HTTP_COOKIE_VARS;
$_SERVER = &$HTTP_SERVER_VARS;
$_FILES = &$HTTP_POST_FILES;
$_REQUEST = array_merge($_GET, $_POST, $_COOKIE);
}
$act = $_GET['act'];
if($act == "")
{
echo('
<html>
<head>
<title>Nex-Gen-BB Installer Script=Step 1</title>
</head>
<body>
<center><table border="0"><tr><td><img src="img/install_logo.png" alt="Logo" />
</td></tr><tr><td>Welcome Nex-Gen-BB Install File, Thanks For Choosing Nex-Gen BB For your Bulletin Board Needs <img src="img/smile.gif" alt=":)" /><br />
<form action="index.php?act=1" method="post"><input type="submit" value="Next Step"></form></td></tr></table>
</body>
</html>
');
}
elseif($act == "1")
{
if(!file_exists('./../setting.php'))
{
die('<title>Error</title><font color="red"><center><img src="img/install_logo.png"><br />Sorry, we could not find the setting.php file, please upload again.</font>');
}
elseif(!is_writable('./../setting.php'))
{
die('<title>Error</title><font color="red"><center><img src="img/install_logo.png"><br />Sorry, you need to CHMOD setting.php to 777</font>');
}
else
{
echo('<title>Success</title><font color="green"><center><img src="img/install_logo.png"><br />Success, you are ready for step 3!</font><br />
<form action="index.php?act=2" method="post"><input type="submit" value="Next Step"></form>');
}
}
elseif($act == "2")
{
$dataname = $_POST['dataname'];
echo('<title>MySQL and Board Settings</title><table align="center" border="0"><tr><td>
<img src="img/install_logo.png" /><br /><h4>Board and MySQL Settings</h4><br /><br />
<form action="index.php?act=3" method="post">
MySQL Server: <input type="text" name="server" size="30" value="localhost"> <b>Most of the Time localhost</b><br />
MySQL Database: <input type="text" name="database" size="30" value="'.$dbname.'"> <b>Enter Your MySQL Database here</b><br />
Username: <input type="text" name="username" size="30"> <b>Enter Your MySQL Username</b><br />
Password: <input type="password" name="pass" size="30"> <b>Enter Your MySQL Password</b><br /><br />
<input type="submit" value="Submit Info"></form>');
}
elseif($act == "3")
{
$server = $_POST['server'];
$database = $_POST['database'];
$username = $_POST['username'];
$pass = $_POST['pass'];
echo(installcheck1($server, $database, $username, $pass));
echo('<form action="index.php?act=4" method="post">
<input type="submit" value="Go Onto Writing and Testing MySQL"></form> ');
}
elseif($act == "4")
{
echo('Trying to Connect To The Database with that info.....');
$sqlconnect = @mysql_connect($server, $username, $pass);
if(!$sqlconnect)
{
echo('<b>Trying to connect to the database server.............</b><br />ERROR!');
die();
}
else
{
echo('Trying to connect to the database server.............<br />Great');
}
$dbtest = @mysql_select_db($database);
if(!$dbtest)
{
echo('Trying to connect using the database you gave.... Error!');
die();
}
else
{
echo('Trying to connect using the database you gave.... Success!');
}
echo('Writing to settings.php Standby....');
$write = fopen("./../settings.php", "w");
fwrite($write, "<"."?php\n\n/
$server = \"$server\"; \n//
$db = \"$database\"; \n//
$user_db = \"$username\"; \n//
$pass_db = \"$pass\"; \n//
\n\n\n?".">\n");
echo('Closing Config.php');
fclose($write);
echo('Now that we have written the info too settings.php, we can now make the mysql tables<br ?><a href="/index.php?act=5>Go Onto Step 6</a>');
}
elseif($act == "5")
{
require_once('./../settings.php');
$sqltable1 = mysql_query("
CREATE TABLE
`nex_users`
(
`id` SMALLINT(5) NOT NULL AUTO_INCREMENT ,
`password` VARCHAR(75) NOT NULL ,
`email` VARCHAR(100) NOT NULL ,
`typeuser` INT(1) NOT NULL ,
`posts` INT(20) NOT NULL ,
`icq` VARCHAR(50) NOT NULL ,
`aim` VARCHAR(50) NOT NULL ,
`msn` VARCHAR(50) NOT NULL ,
`yim` VARCHAR(50) NOT NULL ,
`gtalk` VARCHAR(50) NOT NULL ,
PRIMARY KEY ( `id` )
)
TYPE = MYISAM");
if(!$sqltable1)
{
echo('We are now making the table nex_users, ERROR, we have encountered an error');
}
else
{
echo('We are now making the table nex_users, SUCCESS the table has been made');
}
$sqltable2 = mysql_query("
CREATE TABLE
`nex_forums`
`id` SMALLINT(5) NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(50) NOT NULL ,
`descript` VARCHAR(500) NOT NULL ,
`locked` VARCHAR(10) NOT NULL ,
`parentid` INT(50) NOT NULL ,
PRIMARY KEY ( `id` )
)
TYPE = MYISAM");
if(!$sqltable2)
{
echo('Nex_Forums table could not be created');
}
else
{
echo('Success! We mad the table nex_forums');
}
$sqltable3 = mysql_query("
CREATE TABLE
`nex_posts`
(
`id` SMALLINT(5) NOT NULL AUTO_INCREMENT ,
`forumid` INT(10) NOT NULL ,
`threadid` INT(20) NOT NULL ,
`name` VARCHAR(100) NOT NULL ,
`message` TEXT NOT NULL ,
`poster` VARCHAR(30) NOT NULL ,
PRIMARY KEY ( `id` )
)
TYPE = MYISAM");
if(!$sqltable3)
{
echo('We can not create the posts table!');
}
else
{
echo('Succes, the posts table has been made!');
}
$sqltable4 = mysql_query("
CREATE TABLE
`nex_thread`
(
`id` SMALLINT(5) NOT NULL AUTO_INCREMENT ,
`forumid` INT(10) NOT NULL ,
`name` VARCHAR(100) NOT NULL ,
`message` TEXT NOT NULL ,
`date` VARCHAR(100) NOT NULL ,
`poster` VARCHAR(30) NOT NULL ,
`locked` VARCHAR(10) NOT NULL ,
`sticky` VARCHAR(10) NOT NULL ,
PRIMARY KEY ( `id` )
)
TYPE = MYISAM");
if(!$sqltable4)
{
echo('Sorry, the threads table can not be made');
}
else
{
echo('The threads table has been made');
}
$sqltable5 = mysql_query("
CREATE TABLE
`nex_ses`
(
`userid` INT(20) NOT NULL ,
`ip` VARCHAR( 100 ) NOT NULL ,
`forumid` INT( 20 ) NOT NULL ,
`threadid` INT( 20 ) NOT NULL ,
PRIMARY KEY ( `ip` )
)
TYPE = MYISAM");
if(!$sqltable5)
{
echo('Sorry, we can not make the sessions table');
}
else
{
echo('We have made the sessions table');
}
$sqltable6 = mysql_query("
CREATE TABLE
`nex_cat`
(
`id` INT( 10 ) NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(75) NOT NULL ,
`descript` TEXT NOT NULL ,
`order` INT(10) NOT NULL ,
PRIMARY KEY ( `id` )
)
TYPE = MYISAM");
if(!$sqltable6)
{
echo('Sorry, we can not make the cat table');
}
else
{
echo('We have made the cats table');
}
if(!$sqltable1 || !$sqltable2 || !$sqltable3 || !$sqltable4|| !$sqltable5 || !$sqltable6)
{
echo('Sorry, we have 1 or more errors, please see what is wrong');
}
}
else
{
echo('Success all tables have been made!');
}
mysql_close();
elseif($act == "6")
{
echo('Coming Soon');
}
?>
|
|
|
|
04-02-2006
|
#6 (permalink)
|
|
Registered User
Join Date: May 2005
Location: England (South)
Posts: 40
|
Great thanks working now once i find two missing files!
-Thanks Trev
__________________
Space Cowboy
Thanks for all the help here guys!
Last edited by Space Cowboy; 04-02-2006 at 09:50 PM..
|
|
|
04-03-2006
|
#7 (permalink)
|
|
Registered User
Join Date: Mar 2006
Location: Comodoro Rivadavia, Chubut, ARgentina.
Posts: 22
|
hello..i was looking the code..
i would use a switch statement..something like this:
//the install script could be called many times
//so first check if the tables allready exist or not.
if (check the tables) { echo "nex-gen-bb is installed"; }
else {
switch($act){
case 1: //action 1
break;
case 2: //action 2
break;
case 3: //action 2
break;
case 4: //action 2
break;
default:
here print the html code
with the button "Next Step"
}
}
with the if-elseif-else if $act was 1..after doing 1..
will ckech if is 2, 3, 4, 5, and 6..
with the switch..if $act is 1..you do the action 1 and then
break..so you jump to outside the switch without checking
if act is 2, 3, 4, 5, or 6.
I hope this helps =)
(again..sorry my english lol)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +1. The time now is 04:58 PM. Content Relevant URLs by vBSEO 3.2.0
|