Jump to content

Installing Tables


mark_wi

Recommended Posts

I have a script I have been working on and it seems to no longer install on my server I tested on another on and it installs just fine.

Here is the part which is used to install

[code]
echo "<center><h3>Installing...</h3></center>";
    $dbi = mysql_connect($db_host, $db_username, $db_pass);
    mysql_select_db("$db_name",$dbi);
    echo "<center><font face=\"monospace\">Creating Main Cam Table <b>".$prefix."_cams</b>...</font></center>";
    $sql = 'CREATE TABLE ';
    $sql .=    $prefix;
    $sql .= '_cams( camname varchar( 60 ) NOT NULL default \'\', email varchar( 255 ) NOT NULL default \'\', camurl varchar( 255 ) NOT NULL default \'\', url varchar( 255 ) NOT NULL default \'\', id int( 11 ) NOT NULL default \'\'auto_increment, noupdate tinyint( 11 ) NOT NULL default \'0\', PRIMARY KEY ( id ) ) TYPE = MYISAM ';     
    $result = mysql_query($sql);
    if(!$result){echo "<center><font color=\"red\" face=\"monospace\">Error!</font></center><br><br>\n\n";die();}
    else {echo "<center><font color=\"blue\" face=\"monospace\">Success!</font></center><br><br>\n\n";}

    echo "<center><font face=\"monospace\">Creating Temp Cam Table <b>".$prefix."_cams_temp</b>...</font></center>";
    $sql = 'CREATE TABLE ';
    $sql .=    $prefix;
    $sql .= '_cams_temp(camname varchar(60) NOT NULL default \'\', email varchar(255) NOT NULL default \'\', camurl varchar(255) NOT NULL default \'\', url varchar(255) NOT NULL default \'\' ) TYPE=MyISAM ';     
    $result = mysql_query($sql);
    if(!$result){echo "<center><font color=\"red\" face=\"monospace\">Error!</font></center><br><br>\n\n";die();}
    else {echo "<center><font color=\"blue\" face=\"monospace\">Success!</font></center><br><br>\n\n";}
[/code]
Link to comment
https://forums.phpfreaks.com/topic/10041-installing-tables/
Share on other sites

[!--quoteo(post=375405:date=May 19 2006, 07:40 PM:name=Houdini)--][div class=\'quotetop\']QUOTE(Houdini @ May 19 2006, 07:40 PM) [snapback]375405[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Is it possible that one server allows 'short' tags and the one where the script does not work is not using short tags. e.g. [b]<?php verses <?[/b] If the Script starts with <? and not <?php then change it to <?php and try again.
[/quote]

I do have the scripts starting with <?php this is the full setup

[code]

if (!empty($_GET)) {
extract($_GET);
} else if (!empty($HTTP_GET_VARS)) {
extract($HTTP_GET_VARS);
}

if (!empty($_POST)) {
extract($_POST);
} else if (!empty($HTTP_POST_VARS)) {
extract($HTTP_POST_VARS);
}
include('config.php');

if($go=="yes")
{
    echo "<center><h3>Installing...</h3></center>";
    $dbi = mysql_connect($db_host, $db_username, $db_pass);
    mysql_select_db("$db_name",$dbi);
    echo "<center><font face=\"monospace\">Creating Main Cam Table <b>".$prefix."_cams</b>...</font></center>";
    $sql = 'CREATE TABLE ';
    $sql .=    $prefix;
    $sql .= '_cams( camname varchar( 60 ) NOT NULL default \'\', email varchar( 255 ) NOT NULL default \'\', camurl varchar( 255 ) NOT NULL default \'\', url varchar( 255 ) NOT NULL default \'\', id int( 11 ) NOT NULL default \'\'auto_increment, noupdate tinyint( 11 ) NOT NULL default \'0\', PRIMARY KEY ( id ) ) TYPE = MYISAM ';     
    $result = mysql_query($sql);
    if(!$result){echo "<center><font color=\"red\" face=\"monospace\">Error!</font></center><br><br>\n\n";die();}
    else {echo "<center><font color=\"blue\" face=\"monospace\">Success!</font></center><br><br>\n\n";}

    echo "<center><font face=\"monospace\">Creating Temp Cam Table <b>".$prefix."_cams_temp</b>...</font></center>";
    $sql = 'CREATE TABLE ';
    $sql .=    $prefix;
    $sql .= '_cams_temp(camname varchar(60) NOT NULL default \'\', email varchar(255) NOT NULL default \'\', camurl varchar(255) NOT NULL default \'\', url varchar(255) NOT NULL default \'\' ) TYPE=MyISAM ';     
    $result = mysql_query($sql);
    if(!$result){echo "<center><font color=\"red\" face=\"monospace\">Error!</font></center><br><br>\n\n";die();}
    else {echo "<center><font color=\"blue\" face=\"monospace\">Success!</font></center><br><br>\n\n";}
    # Start Delete Install and Redirect#
    echo "<center><font face=\"verdana\" size=\"3\"><b>Deleting File:</b> \"install.php\"</font></center><p>";
    echo "<center><font face=\"verdana\" size=\"2\" color=\"green\">";
    $delete = unlink("install.php");
    if($delete){
    echo "<center><b>Setup file deleted!</b></font></center>";
     }
    else{
    echo "<center><b>Unable to delete Setup file (install.php) go and delete the set up file manually!</b></center></font>";
}

   echo "<p><center><font face=\"verdana\" size=\"3\" color=\"darkblue\"><b>Redirecting you in 30 seconds...</b></center></font>";
   echo "<META HTTP-EQUIV=Refresh CONTENT=\"30; URL=index.php\">";
   #End Install And Redirect#
    
    echo "<center><font color=\"blue\"Please remove the install file!!You can start to tweak the header, and set up any other configuration details you'd like.</font></center><br>\n";
    
    echo"<center><a href=\"admin/index.php\">Admin Area</a></center><br>";
    echo"<center><a href=\"/portal/index.php\">Cam Portal</a></center>";
}

else
{

}

?>

[/code]
Link to comment
https://forums.phpfreaks.com/topic/10041-installing-tables/#findComment-37337
Share on other sites

Im looking over and over and over the problem seems to be in making the first table.When I remove that part it will install to the temp table.

this is the first table..

[code]
echo "<font face=\"monospace\">Creating Main Cam Table <b>".$prefix."_cams</b>...</font>";
    $sql = 'CREATE TABLE ';
    $sql .=    $prefix;
    $sql .= '_cams( camname varchar( 60 ) NOT NULL default \'\', email varchar( 255 ) NOT NULL default \'\', camurl varchar( 255 ) NOT NULL default \'\', url varchar( 255 ) NOT NULL default \'\', id int( 11 ) NOT NULL default \'\'auto_increment, noupdate tinyint( 11 ) NOT NULL default \'0\', PRIMARY KEY ( id ) ) TYPE = MYISAM ';     
    $result = mysql_query($sql);
    if(!$result){echo "<font color=\"red\" face=\"monospace\">Error!</font><br><br>\n\n";die();}
    else {echo "<font color=\"green\" face=\"monospace\">Success!</font><br><br>\n\n";}
[/code]
Link to comment
https://forums.phpfreaks.com/topic/10041-installing-tables/#findComment-37392
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.