Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Need a 2nd pair of eyes
Old 04-06-2005, 01:47 PM Need a 2nd pair of eyes
merlin's Avatar
Skilled Talker

Posts: 52
Trades: 0
Hi,

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'])) {
    

        require_once(
'Cheq_Register\mysql_connect_register.php');
        
        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($resultMYSQL_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

if (isset($message)) {
    echo 
'<font color="red"> '$message'</font>';
    }
    }
?>
merlin is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-06-2005, 01:53 PM
Extreme Talker

Posts: 219
Location: UK, East Anglia
Trades: 0
PHP Code:
echo "<font color=\"red\">" $message "</font>"
timsquash5 is offline
Reply With Quote
View Public Profile
 
Old 04-06-2005, 02:00 PM
merlin's Avatar
Skilled Talker

Posts: 52
Trades: 0
Fixed it but I still have the same problem.
merlin is offline
Reply With Quote
View Public Profile
 
Old 04-06-2005, 02:08 PM
Extreme Talker

Posts: 219
Location: UK, East Anglia
Trades: 0
what is the error?
timsquash5 is offline
Reply With Quote
View Public Profile
 
Old 04-06-2005, 02:28 PM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
You've missed a } i think mate.

PHP Code:
if ($an && $t && $d) { //if everthing's OK 
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!
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 04-06-2005, 05:12 PM
amw_drizz's Avatar
Ultra Talker

Posts: 340
Name: Jon
Location: New York
Trades: 0
you are missing the } bracket on your 4th if statement
__________________
AMW_Drizz
Dev Machine:: Apache 2.2.6 PHP 5.2.6 MySQL 5.1
amw_drizz is offline
Reply With Quote
View Public Profile Visit amw_drizz's homepage!
 
Old 04-06-2005, 05:19 PM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
Thats what I said a fair few hours ago...
__________________
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
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 04-06-2005, 05:35 PM
merlin's Avatar
Skilled Talker

Posts: 52
Trades: 0
And you were right, I was missing the } bracket. Thanks for everyone's help.

- Merlin
merlin is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Need a 2nd pair of eyes
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26120 seconds with 12 queries