I'm getting a parse error in the attached code. The error points to the last line (closing tag for HTML) so I now I've missed something. I have gone over the code 5 times and still can not find the problem. Can anyone see what I missed?
PHP Code:
<?php
//if the user pressed the submit button (if it is set)
if (isset($_POST['Submit1'])) {
function escape_data ($data) {
global $dbc;
if (int_get('magic_quotes_gpc')) {
$data = stripslashes($data);
}
return mysql_real_escape_string($data, $dbc);
} //End of function
$message = NULL; // Create an empty variable
// Check for an Account Number
if(empty($_POST['Account_Number_2'])) {
$an = FALSE;
$message .='<p>You Forgot to enter the Account Number</p>';
} else {
$an = escape_data($_POST['Account_Number_2']);
}
// Check for a Cheque Total
if(empty($_POST['Total_2'])) {
$t = FALSE;
$message .='<p>You Forgot to enter the Cheque Total</p>';
} else {
$t = escape_data($_POST['Total_2']);
}
// Check for a Date Forwarded
if(empty($_POST['Date_Sent_2'])) {
$d = FALSE;
$message .='<p>You Forgot to enter the Date Forwarded</p>';
} else {
$d = escape_data($_POST['Date_Sent_2']);
}
}
if ($an && $t && $d) { //if everthing's OK
$query = "SELECT Account_Number FROM accounts WHERE (Account_Number_2='$an' AND Total_2='$t')";
$result = @mysql_query ($query);
$num = mysql_num_rows ($results);
if ($num == 1) {
$row = mysql_fetch_arry($result, MYSQL_NUM);
// Make the query to update the datebase
$query = "UPDATE accounts SET Date_Sent_2='$t' WHERE Account_Number_2=$row[0]";
$result = @mysql_query ($query); //Run the query
if (mysql_affected_rows() == 1) { //if it ran OK
echo '<p><b>Done as per your request</p></b>';
exit(); //Quit the script
} else { //if it did not run OK
$message = '<p>An Error has occured</p><p>' . mysql_error() . '</p>';
}
mysql_close(); //close the connection
That one has still been left open i'm sure, try adding an extra } at the end of the script.
__________________ A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill
Please visit my sites: Please login or register to view this content. Registration is FREE | Please login or register to view this content. Registration is FREE
Last edited by leavethisplace; 04-06-2005 at 02:29 PM..
Reason: } not { i'm so stupid!
__________________ A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill
Please visit my sites: Please login or register to view this content. Registration is FREE | Please login or register to view this content. Registration is FREE