thomasross
New Member
- Messages
- 5
- Reaction score
- 0
- Points
- 0
Ok, I am experiencing a problem where I get the following error:
The action which I am trying to do is take a name and e-mail address from a form on "base_list.php" and input it into a database using "base_app_process.php" so that I will be able to access the details to add to a mailing list manually. I am also using the "base_app_process.php" file to send a confirmation e-mail to the user and display a confirmation web-page.
I am new to PHP, so sorry if any of the coding is messy.
Any help would be gratefully recieved.
base_list.php
I have erased part of this before the form section as it is just text and links in a table and not a part of the bit I am interested in - and I am over the character limit for this post.
base_app_process.php
If you need any more information to help me, just ask. Thanks in advance.
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/tross/public_html/Timetables/base_app_process.php on line 33
Column count doesn't match value count at row 1
The action which I am trying to do is take a name and e-mail address from a form on "base_list.php" and input it into a database using "base_app_process.php" so that I will be able to access the details to add to a mailing list manually. I am also using the "base_app_process.php" file to send a confirmation e-mail to the user and display a confirmation web-page.
I am new to PHP, so sorry if any of the coding is messy.
Any help would be gratefully recieved.
Database Fields:
"userid" int(11) auto_increment PRIMARY
"name" varchar(60)
"email_address" varchar(60)
base_list.php
I have erased part of this before the form section as it is just text and links in a table and not a part of the bit I am interested in - and I am over the character limit for this post.
PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<?
include 'header.html';
?>
<html>
<head>
<title>FlyintAIR Crew Centre: Timetables: Home</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
table{font-family: Arial; color: #cc9933}
-->
</style>
</head>
<body>
<form name="form1" method="post" action="base_app_process.php">
<table border="0" cellpadding="10" cellspacing="0" align="center" width="60%" style="font-family: Arial; font-size: 12pt; color: #cc9933">
<tr>
<td align="left" valign="top" style="color: black"><b><big><font face='Arial' color="blue">Join Timetable Update Mailing List</b></big></font><BR><BR>
If you are using the PDF versions of our timetables, we ask that you submit your e-mail address to us so that we can contact you in the event of any updates to the timetable being necessary. This will ensure that you are always up-to-date with the latest copy of the timetable and will therefore reduce the risk of submitting an invalid PIREP. <br><br>
This mailing list is only valid for our "By-Base" PDF Timetables, if you wish for your details to be added to the "By-Aircraft" PDF Timetables mailing list, you must do this separately by clicking <a href="ac_list.php">here</a>.
<br><br>
You will receive an e-mail to confirm that your details have been received. If you do not receive this, please e-mail your details and any error messages recieved to <a href="mailto:flyintair@gmail.com">flyintair@gmail.com</a>.</tr>
</table>
<table border="0" cellpadding="10" cellspacing="0" align="center" width="60%" style="font-family: Arial; font-size: 11pt; color: #cc9933">
<tr><center><BR><hr width=50%><BR></center></tr>
<tr>
<td align="left" valign="top">Name</td>
<td><input name="name" type="text" id="name" value=""></td>
</tr>
<tr>
<td align="left" valign="top">Email Address</td>
<td><input name="email_address" type="text" id="email_address" value=""></td>
</tr>
<tr>
<td align="left" valign="top"> </td>
<td><input type="submit" name="Submit" value="Join Now!"></td>
</tr>
</table>
</form>
<table border="0" cellpadding="10" cellspacing="0" align="center" width="60%" style="font-family: Arial; font-size: 10pt; color: #cc9933">
<tr><hr width=100%><BR><BR></tr>
<tr><b><big><font face = "Arial"><a href="timetable_index.php">Return to Timetable Centre Home</a></b></big><br></font></tr>
<tr><BR><BR><hr width=100%><BR><BR></tr>
<tr><font face="Arial"><b>If you have any questions or queries about any aspect of FlyintAIR - please do not hesitate to contact me and I will to my best to address these, e-mail me at <a href="mailto:flyintair@gmail.com">flyintair@gmail.com</a>
</table>
</body>
</html>
<? echo "<p> </p>";
include 'footer.php';
?>
base_app_process.php
PHP:
<?
include 'db.php';
// Define post fields into simple variables
$name = $_POST['name'];
$email_address = $_POST['email_address'];
/* Do some error checking on the form posted fields */
if((!$name) || (!$email_address)){
echo 'You did not submit the following required information! <br />';
if(!$name){
echo "Name is a required field. Please enter it below.<br />";
}
if(!$email_address){
echo "Email Address is a required field. Please enter it below.<br />";
}
include 'base_list.php'; // Show the form again!
/* End the error checking and if everything is ok, we'll move on to
creating the user account */
exit(); // if the error checking has failed, we'll exit the script!
}
/* Let's do some checking and ensure that the user's email address does not exist in the database */
$sql_email_check = mysql_query("SELECT email_address FROM times-base-update WHERE email_address='$email_address'");
$email_check = mysql_num_rows($sql_email_check);
if($email_check > 0){
echo "<strong>Your email address is already on the mailing list!<br />";
unset($email_address);
include 'base_list.php'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
/* Everything has passed the error check that we have done.*/
// Enter info into the Database.
$info2 = htmlspecialchars($info);
$sql = mysql_query("INSERT INTO times_base_update (name, email_address) VALUES('$name', '$email_address', now())") or die (mysql_error());
if(!$sql){
echo 'There has been an error creating your account. Please contact the webmaster.';
} else {
$userid = mysql_insert_id();
// Let's mail the user!
$subject = "Timetable Update Mailing List!";
$message = "Dear $name,
This e-mail is a confirmation that your e-mail address has now been successfully
added to our mailing list.
As part of this mailing list, you will receive updates any time that we update
the PDF 'By-Base' timetables, allowing you to stay up-to-date with the latest
copy of our timetable. As a member of this mailing list, you will NOT receive
any e-mail updates regarding PDF 'By-Aircraft' or Web-based timetables. You
can subscribe to the PDF 'By-Aircraft' mailing list by visiting the page linked
below:
http://www.flyintair.x10hosting.com/Timetables/ac_list.php/
If you did not submit your details to join this mailing list, would like your
details removed from this list, or have any further questions - please e-mail
me at flyintair@gmail.com or by using the Feedback/Contact form on the website.
Happy Flying,
Thomas Ross,
CEO FlyintAIR Virtual Airlines
http://www.spanglefish.com/intAIRnational/
This is an automated response, please do not reply!";
mail($email_address, $subject, $message, "From: FlyintAIR VA <flyintair@gmail.com>\nX-Mailer: PHP/" . phpversion());
}
mysql_close($connection);
include 'header.html';
?>
<html>
<head><title>FlyintAIR Crew Centre: Mailing List Application Processed</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style="text/css">
<!--
body{font-family: Arial; color: #cc9933}
-->
</style>
</head>
<body>
<table align="center" style="font-size: 12pt">
<tr>
</tr>
<tr>
<td align="center"><font face="Arial" color="blue"><b><big>Your application to join our PDF-Base Timetable Update Mailing List has been processed.</font></b></big></td>
</tr>
<tr>
</tr>
<tr>
<td align="center"><font face="Arial" color="blue"><b>You should now recieve an e-mail confirming this.</font></b></td>
</tr>
<tr>
<td align="center"><font face="Arial" color="blue"><b>Please be aware that the e-mail may be in your spam or junk e-mail folder.</b></font></td>
</tr>
<tr>
<td align="center"><font face="Arial" color="blue"><b>If you do not receive this, please e-mail your details and any error messages recieved to <a href="mailto:flyintair@gmail.com">flyintair@gmail.com</a>./<b></td>
</tr>
<tr>
<td align="center"><font face="Arial"><a href="base_list.php">Return to Base PDF Timetables</a></td>
</tr>
<tr>
<td align="center"><font face="Arial"><a href="timetable_index.php">Return to Timetable Service Home</a></td>
</tr>
</table>
</body>
</html>
If you need any more information to help me, just ask. Thanks in advance.