I am getting this notice:
Notice: Undefined variable: begin in /home/wwwfulc/public_html/install.php
on line 21
When I hit subit it just prints " Completed." and doesn't update the
database at all.
Can anyone help me find my glitch in this?
You can see it in action here http://www.fulco.net/install.php
You can see the whole file (minus html tags at beginning and end) here
http://www.fulco.net/installphp.txt
Here's the code (minus the SQL Dump).
PHP:
_____
<html>
<head>
<title>Xenology Database Install Script</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?php
error_reporting(E_ALL);
require("xenosetup.php");
$con = mysql_connect($host, $user, $pass) or die ("I cannot connect to the
database because:" . mysql_error());
mysql_select_db($db, $con) or die("I cannot select the correct database
because: " . mysql_error());
if ($begin){
$sql = 'CREATE TABLE xeno(SQL DUMP HERE)";
echo "Completed.";
} else {
printf("<a href=\"%s?begin=1\">Begin</a><br>", $PHP_SELF);
}
?>
</body>
</html>
_____
Your help is appreciated!
Yours in Service,
Jason Britton
Scar's <http://st.fulco.net/> Legion
Vincit imitationem veritas.
--
-------------------------------------------------
Cristian MARIN
InterAKT Online (www.interakt.ro)
+4021 411 2610
cri...@interakt.ro
"Fulco Of Scarborough" <fu...@fulco.net> wrote in message news:000301c32cf9$c715a830$dad2fea9@master...
*********Begin Code**************
<html>
<head>
<title>Xenology Database Install Script</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?php
error_reporting(E_ALL);
require("xenosetup.php");
$con = mysql_connect($host, $user, $pass) or die ("I cannot connect to the
database because:" . mysql_error());
mysql_select_db($db, $con) or die("I cannot select the correct database
because: " . mysql_error());
if (isset($_GET['begin'])){
$sql1 = 'CREATE TABLE xeno( id int( 10 ) NOT NULL auto_increment, xeno
varchar( 50 ) default NULL , xenotxt text, image varchar( 255 ) default NULL
, PRIMARY KEY ( id ) , UNIQUE KEY id( id ) )';
$sql2 = "INSERT INTO xeno (id, xeno, xenotxt, image) VALUES (**snip**)";
$result1 = mysql_query($sql1);
$result2 = mysql_query($sql2);
echo "Completed.";
} else {
$begin = "0";
printf("<a href=\"%s?begin=1\">Begin</a><br>", $_SERVER['PHP_SELF']);
}
?>
</body>
</html>
*********End Code**************
In addition, the Xenosetup.php file looks like this (when stripped):
*********Begin Code**************
<?php
/*This document Copyright 2003 Scar's Legion (http://st.fulco.net).
There is no warranty expressed or implied by the use of this script.
It is published as linkware, and must retain all copyrights and
links as they where originally programmed. If you are caught using
this script without meeting these standards you will be prosecuted.*/
//Edit this to reflect you information.
//This is the location of your database. "localhost" is usually acceptable.
$host= "localhost";
//$user is your database username.
// sybtax is $user= "username";
$user= "";
//$pass is your database password.
// sybtax is $pass= "password";
$pass= "";
//$db is the database name.
$db= "xeno";
?>
*********End Code**************
Thanks for all your help and I must say the people over at PHP Builder
Community Forums (http://www.phpbuilder.com) really helped with this project
also.
Yours in Service,
Jason Britton
Scar's Legion