Matt,
I sent this through on Sunday, but you might have missed it. Here it is
again just in case. It is the section of script that might show what is
wrong with connecting to the db.
Joseph
From: "Matt Warden" <[EMAIL PROTECTED]>
>
>
> Joseph,
>
> Joseph Harris wrote:
> > <?php
> > //connect to server and select database - organise include
> > $conn = mysql_connect("localhost", "root", "") or die(mysql_error());
> > mysql_select_db("loop",$conn) or die(mysql_error());
> > ?>
> >
> > And this works - in small test files both as a cut and paste and as an
> > include(). I am just foxed by what is making it fail in the script as
a
> > whole.
>
> Could you include the code from where you include() the above to where
> you are calling the INSERT that is generating your referenced error?
>
>
> - --
> Matt Warden
> Miami University
> Oxford, OH, USA
> http://mattwarden.com
>
Here it is Matt:
<?php
include $_SERVER['DOCUMENT_ROOT'].
'/www.looperman-is-ready.com/layout.php';
//set some variables
$_SERVER['DOCUMENT_ROOT'].
'/www.looperman-is-ready.com/includes/db_connect_loop.php';
$email_error = false;
$req = (!isset($_REQUEST['req'])) ? 'default' : $_REQUEST['req'];
switch($req){
case "process" : // code to process signup input and place in database
// myheader("Happy Birthday");
$errors = "<h4>Form Input Errors:".
"</h4>\n\n";
//Validate all required fields were posted
if(!$_POST['first_name'] ||
!$_POST['last_name'] ||
!$_POST['email_address'] ||
!$_POST['country'] ||
!$_POST['birthdate']){
$error = true;
if (!$_POST['first_name']) {
$errors .= "Missing first Name\n";
}
if (!$_POST['last_name']) {
$errors .= "Missing Last Name\n";
}
if (!$_POST['email_address']) {
$errors .= "Missing Email Address\n";
$email_error = true;
}
if (!$_POST['country']) {
$errors .="Missing Country\n";
}
if (!$_POST['birthdaye']) {
$errors .= "Missing Birthdate\n";
}
}
footer();
exit;
//All checks have passed; insert user in database
$sql = @mysql_query("INSERT INTO loop_allname (first_n, last_n,
email_address, birth, countryID, is_current, start)
VALUES('$_POST[first_name]',
'$_POST[last_name]',
'$_POST[email_address]',
'$_POST[birthdate]',
'$_POST[country]',
1,
now(),
)");
if (!$sql) {
echo 'error inserting your information into MySQL; '
.mysql_error();
footer();
exit();
}
---and I've had the quotes both on and off the figure 1 in the values.
Thanks for taking a look.
Joseph
____ The WDVL Discussion List from WDVL.COM ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
Send Your Posts To: [email protected]
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016
Please include the email address which you have been contacted with.