If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > PHP $parse error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-23-11, 01:16
Alcatraz Alcatraz is offline
Registered User
 
Join Date: Oct 2011
Posts: 5
PHP $parse error

Hi all

I have been working on the application for 3 hrs now. I know I have an error but cannot find it. A fresh set of eyes would be greatly appreciated.

Thanks in advance!
Attached Files
File Type: txt function_do.txt (12.3 KB, 1 views)
Reply With Quote
  #2 (permalink)  
Old 10-23-11, 05:42
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
line 53 mysql_close($connect) appears outside the the function login_do
line 203..205 you have an if statement followed by and end / start php tags followed by an else statement
line 214 <?php}?>
line 192 you have a while statement followed by an ?>, some html then <?php, I don't know if this is valid, but it doesn't look right to me
line 384 you have a while statement followed by an end brace with no code to process the while loop

if you get yourself a decent PHP editor these errors would be easily spotted. I used netbeans with the PHP extensions to spot these (well TBH to look where netbeans spotted problems)

I think part of your problem is the style you are using to write the code. Its not the easiest to use. some people recommend using a framework such as smarty to separate the PHP from the HTML.

what I tend to do is create a variable and 'dump' the text into that variable, but in any event the idea is to stop jumping in and out of PHP

there is no need to terminate php between each code block (ferinstance you encapsulate each function with php tags (<?php; ?>), there is no need to do so if as soon as you terminate a php block if the next line starts a new php block. see lines 6..8, 54..56, 65..67 and so on

a suggestion: you need to think about commenting your code so you (or others) can understand the process

also bear in mind that with the way that code is set up you may also be transmitting other characters eg spaces. granted they may not be an issue with most scripts but you do need to be carefull what you send to the browser.
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 10-23-11, 21:17
Alcatraz Alcatraz is offline
Registered User
 
Join Date: Oct 2011
Posts: 5
Thanks for the assistance I really appreciate an experienced set of eyes looking it over.

I know the format is kinda weird and I didn't like it but the prof wanted us to use that style because he thinks it's easier to follow. He didn't hold us to it but with the little php experience I have I figured I would follow along.

The toughest thing for me has been the "<?php do something ?>" then going into html then back into php again. I don't know how many times I jacked that all up.

I've been using Notepad++ to write with and then run it in the localhost and debug from what error messages I get there.

Thanks again for the assistance.

Alcatraz out!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On