[PHP-DB] Resolved: Glitching install script.

2003-06-09 Thread Fulco of Scarborough
I have gotten this script working like this:

*Begin Code**
html
head
titleXenology Database Install Script/title
/head

body bgcolor=#FF text=#00
?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/abr, $_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
[EMAIL PROTECTED]
 
Vincit imitationem veritas.


 
   Fulco Of Scarborough [EMAIL PROTECTED] wrote:
   I'm still new to php and my syntax is not great.
 
 
 
   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
 
   titleXenology Database Install Script/title
 
   meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
 
   /head
 
 
 
   body bgcolor=#FF text=#00
 
   ?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/abr, $PHP_SELF);
 
   }
 
   ?
 
   /body
 
   /html
 
 
 
 _
 
 
 
   Your help is appreciated!
 
 
 
   Yours in Service,
 
   Jason Britton
 
   Scar's http://st.fulco.net/  Legion
 
   [EMAIL PROTECTED]
 
 
 
   Vincit imitationem veritas.
 
 
 




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Glitching install script.

2003-06-07 Thread Fulco of Scarborough
I'm still new to php and my syntax is not great. 

 

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

titleXenology Database Install Script/title

meta http-equiv=Content-Type content=text/html; charset=iso-8859-1

/head

 

body bgcolor=#FF text=#00

?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/abr, $PHP_SELF);

}

?

/body

/html

 

  _  



Your help is appreciated!

 

Yours in Service,

Jason Britton

Scar's http://st.fulco.net/  Legion

[EMAIL PROTECTED]

 

Vincit imitationem veritas.

 



RE: [PHP-DB] PHP/Mysql Script help.

2003-06-06 Thread Fulco of Scarborough
Thanks for all you wonderful help.  With a little tweaking, and a new
debugging program, I have been able to get the results I want.  Now I'm
going to begin adding some security features.  Again, thanks for you help.

Yours in Service,
Jason Britton
Scar's Legion
http://st.fulco.net
[EMAIL PROTECTED]
 
Vincit imitationem veritas.

 -Original Message-
 From: Becoming Digital [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 05, 2003 4:59 AM
 To: 'PHP-DB'
 Subject: Re: [PHP-DB] PHP/Mysql Script help.
 
 I debugged the code and there were a slew of errors.  I've fixed all but
one,
 which I can't correct bcs I don't know the intention.  Most of the errors
came
 from improper syntax, a problem which could have been avoided by using
 consistent code formatting.  I chose to do that for you as well and have
 included the code below.
 
 As for the error I could not correct, it involves the final elseif()
statement.
 The way your code was written, you had two 'else' statements, which is an
 obvious violation.  I corrected that by changing the first (before the
select
 statement) to an elseif(), but I do not know the condition.  Once you
enter it,
 the code should work smoothly.
 
 
 ?php
 
 require(racesetup.php);
 
 $con = mysql_connect($host, $user, $pass) or die(mysql_error());
 
 mysql_select_db($db, $con) or die(mysql_error());
 
 // display individual record
 if ($id)
 {
 error_reporting(E_ALL);
 
 $result = mysql_query(SELECT * FROM nuke_race WHERE id=$id,$con) or
 die(mysql_error());
 
 $myrow = mysql_fetch_array($result) or die(mysql_error());
 
 printf (bRace:/b %s\nbr, $myrow[race]);
 
 echo br;
 
 printf(bDescription:/b %s\nbr, $myrow[racetxt]);
 
 echo br;
 echo brh3a href=\javascript:history.go(-1)\Back/a/h3;
 }
 
 elseif ($_Post['letter'])
 {
 if ($_Post['letter'])
 {
 $result = mysql_query(SELECT * FROM nuke_race WHERE race LIKE
 $_Post['letter']%,$con) or die(mysql_error());
 if ($myrow = mysql_fetch_array($result))
 {   // display list if there are records to display
 do {
 printf(a href=\%s?id=%s\%s/abr\n, $PHP_SELF,
 $myrow[id], $myrow[race]);
 }
 while ($myrow = mysql_fetch_array($result));
 }
 }
 }
 
 //NO CONDITION LISTED!!
 elseif ()
 {
 echo form name=\letter\ method=\post\ action=\races.php\
 
   .   pPick a letter to begin your search/p
   .   p 
   . select name=\select\
   .   option value=\a\A/option
   .   option value=\b\B/option
   .   option value=\c\C/option
   .   option value=\d\D/option
   .   option value=\e\E/option
   .   option value=\f\F/option
   .   option value=\g\G/option
   .   option value=\h\H/option
   .   option value=\i\I/option
   .   option value=\j\J/option
   .   option value=\k\K/option
   .   option value=\L\L/option
   .   option value=\m\M/option
   .   option value=\n\N/option
   .   option value=\o\O/option
   .   option value=\p\P/option
   .   option value=\q\Q/option
   .   option value=\r\R/option
   .   option value=\s\S/option
   .   option value=\t\T/option
   .   option value=\u\U/option
   .   option value=\v\V/option
   .   option value=\w\W/option
   .   option value=\x\X/option
   .   option value=\y\Y/option
   .   option value=\z\Z/option
   . /select
   .   /p
   .   p 
   . input type=\Submit\ name=\submit\ value=\Enter
 information\
   .   /p
   . /form
   .;
 }
 
 else
 // no records to display
 echo Sorry, no records were found!;
 
 ?
 
 
 Edward Dudlik
 Becoming Digital
 www.becomingdigital.com
 
 
 - Original Message -
 From: Fulco of Scarborough [EMAIL PROTECTED]
 To: 'PHP-DB' [EMAIL PROTECTED]
 Sent: Thursday, 05 June, 2003 00:25
 Subject: Re: [PHP-DB] PHP/Mysql Script help.
 
 
 I have still been getting errors, so here goes again.
 
 
 
 I am attempting to design a script that presents the user with a form with
 26 letters to choose from.  When they pick a letter I want it to take them
 to a list of all the entries in my database that begin with the letter
they
 selected in link form.  When they click on the term, I want it to pull up
 the info for that entry.
 
 
 
 I have made some changes and added some error checking:
 
 
 
 ?php
 
 
 
 require(racesetup.php);
 
 $con = mysql_connect($host, $user, $pass) or die(mysql_error());
 
 
 
 mysql_select_db($db, $con) or die(mysql_error());
 
 
 
 // display individual record
 
 
 
 if ($id) {
 
 error_reporting(E_ALL);
 
$result = mysql_query(SELECT * FROM nuke_race WHERE id=$id,$con) or
 die(mysql_error());
 
 
 
$myrow = mysql_fetch_array($result) or die(mysql_error());
 
 
 
printf(bRace:/b %s\nbr, $myrow[race]);
 
   echo br;
 
printf

[PHP-DB] PHP/Mysql Script help.

2003-06-05 Thread Fulco of Scarborough
Greeting everyone, my name is Jason and I am sorry for bugging you since you
probably get a ton of these emails, but I was hoping you all might be able
to help me.  I am attempting to design a script that presents the user with
a form with 26 letters to choose from.  When they pick a letter I want it to
take them to a list of all the entries in my database that begin with the
letter they selected in link form.  When they click on the term, I want it
to pull up the info for that entry.

I am only wanting to get some tips or a sample somewhere you may know of to
get me going in the right direction.

 

Here is my current code so far:

 

?php

require(racesetup.php);

$con = mysql_connect($host, $user, $pass);

 

mysql_select_db($db, $con);

 

// display individual record

 

if ($id) {

 

   $result = mysql_query(SELECT * FROM nuke_race WHERE id=$id,$con);

 

   $myrow = mysql_fetch_array($result);

 

   printf(bRace:/b %s\nbr, $myrow[race]);

  echo br;   

   printf(bDescription:/b %s\nbr, $myrow[racetxt]);

  echo br;

  echo brh3a href=\javascript:history.go(-1)\Back/a/h3;


 

} else {

  echo form name=letter method=\post\
action=\http://st.fulco.net/races.php\;

  pPick a letter to begin your search/p

  p 

select name=\select\

  option value=\a\A/option

  option value=\b\B/option

  option value=\c\C/option

  option value=\d\D/option

  option value=\e\E/option

  option value=\f\F/option

  option value=\g\G/option

  option value=\h\H/option

  option value=\i\I/option

  option value=\j\J/option

  option value=\k\K/option

  option value=\L\L/option

  option value=\m\M/option

  option value=\n\N/option

  option value=\o\O/option

  option value=\p\P/option

  option value=\q\Q/option

  option value=\r\R/option

  option value=\s\S/option

  option value=\t\T/option

  option value=\u\U/option

  option value=\v\V/option

  option value=\w\W/option

  option value=\x\X/option

  option value=\y\Y/option

  option value=\z\Z/option

/select

  /p

  p

input type=\Submit\ name=\letter\ value=\Enter information\

  /p

/form

;  

} else {

 

$result = mysql_query(SELECT * FROM nuke_race WHERE race LIKE
'$letter%',$con);

if ($myrow = mysql_fetch_array($result)) {

 

  // display list if there are records to display

 

  do {

 

printf(a href=\%s?id=%s\%s/abr\n, $PHP_SELF, $myrow[id],
$myrow[race]);

 

  } while ($myrow = mysql_fetch_array($result));

 

} else {

 

  // no records to display

 

  echo Sorry, no records were found!;

}

 

  }

?

 

Thanks for your help in advance.

 

Yours in Service,

Jason Britton

Scar's http://st.fulco.net/  Legion

http://st.fulco.net http://st.fulco.net/  

[EMAIL PROTECTED]

 

Vincit imitationem veritas.

 



Re: [PHP-DB] PHP/Mysql Script help.

2003-06-05 Thread Fulco of Scarborough
I have still been getting errors, so here goes again.

 

I am attempting to design a script that presents the user with a form with
26 letters to choose from.  When they pick a letter I want it to take them
to a list of all the entries in my database that begin with the letter they
selected in link form.  When they click on the term, I want it to pull up
the info for that entry.

 

I have made some changes and added some error checking:

 

?php



require(racesetup.php);

$con = mysql_connect($host, $user, $pass) or die(mysql_error());

 

mysql_select_db($db, $con) or die(mysql_error());

 

// display individual record

 

if ($id) {

error_reporting(E_ALL);

   $result = mysql_query(SELECT * FROM nuke_race WHERE id=$id,$con) or
die(mysql_error());

 

   $myrow = mysql_fetch_array($result) or die(mysql_error());

 

   printf(bRace:/b %s\nbr, $myrow[race]);

  echo br;   

   printf(bDescription:/b %s\nbr, $myrow[racetxt]);

  echo br;

  echo brh3a href=\javascript:history.go(-1)\Back/a/h3;


 

} elseif ($_Post['letter']) {

if ($_Post['letter']) {

$result = mysql_query(SELECT * FROM nuke_race WHERE race LIKE
$_Post['letter']%,$con) or die(mysql_error());

if ($myrow = mysql_fetch_array($result)) {

 

  // display list if there are records to display

 

  do {

 

printf(a href=\%s?id=%s\%s/abr\n, $PHP_SELF, $myrow[id],
$myrow[race]);

 

  } while ($myrow = mysql_fetch_array($result));

   

;  

}

else  {

echoform name=\letter\ method=\post\ action=\races.php\

  .   pPick a letter to begin your search/p

  .   p 

  . select name=\select\

  .   option value=\a\A/option

  .   option value=\b\B/option

  .   option value=\c\C/option

  .   option value=\d\D/option

  .   option value=\e\E/option

  .   option value=\f\F/option

  .   option value=\g\G/option

  .   option value=\h\H/option

  .   option value=\i\I/option

  .   option value=\j\J/option

  .   option value=\k\K/option

  .   option value=\L\L/option

  .   option value=\m\M/option

  .   option value=\n\N/option

  .   option value=\o\O/option

  .   option value=\p\P/option

  .   option value=\q\Q/option

  .   option value=\r\R/option

  .   option value=\s\S/option

  .   option value=\t\T/option

  .   option value=\u\U/option

  .   option value=\v\V/option

  .   option value=\w\W/option

  .   option value=\x\X/option

  .   option value=\y\Y/option

  .   option value=\z\Z/option

  . /select

  .   /p

  .   p 

  . input type=\Submit\ name=\submit\ value=\Enter
information\

  .   /p

  . /form

  . 

 .;

 

}

 else {

  // no records to display

 

  echo Sorry, no records were found!;

}

  

?

 

I am still getting Parse error: parse error, unexpected T_STRING in
/home/wwwfulc/public_html/st/races.php on line 38

 

This is line 38

 

echoform name=\letter\ method=\post\ action=\races.php\

 

 

Thanks for your help!

 

Yours in Service,

Jason Britton

Scar's http://st.fulco.net/  Legion

[EMAIL PROTECTED]

 

Vincit imitationem veritas.