943,948 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1044
  • PHP RSS
Apr 18th, 2008
0

Parse error: syntax error, unexpected T_STRING in E:\Program Files\wamp\www\practice\

Expand Post »
hi, i keep getting this error and i just cant figure out what is wrong. i got this code off a book that uses php v 5.1.4 and my wamp server runs php v 5.2.5, could this be a problem? does anybody know where i could download a good free php texteditor/compiler?
here is the code, line 89 is marked in red..

PHP Syntax (Toggle Plain Text)
  1. if($_POST[fax_number] ) {
  2. [COLOR="Red"]$add_fax_sql = "INSERT INTO fax ("master_id", "date_added", "date_modified", "fax_number", "type")[/COLOR] VALUES ('".$master_id."', now(), now(), '".$_POST["fax_number"]."','".$_POST["fax_type"]."')";
  3. $add_fax_res = mysql_query($mysql, $add_fax_sql)
  4. or die(mysql_error());
  5. }
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
cali_dotcom is offline Offline
51 posts
since Apr 2008
Apr 18th, 2008
0

Re: Parse error: syntax error, unexpected T_STRING in E:\Program Files\wamp\www\practice\

Quote ...
[color="Red"]$add_fax_sql
i dont think this is valid. is it?
Reputation Points: 10
Solved Threads: 1
Light Poster
upstream is offline Offline
43 posts
since Sep 2007
Apr 18th, 2008
0

Re: Parse error: syntax error, unexpected T_STRING in E:\Program Files\wamp\www\pract

Click to Expand / Collapse  Quote originally posted by upstream ...
i dont think this is valid. is it?
no, i tried to highlight the line with the problem with the message text editor but it didn't work. thats why there is the color tags in there
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
cali_dotcom is offline Offline
51 posts
since Apr 2008
Apr 18th, 2008
0

Re: Parse error: syntax error, unexpected T_STRING in E:\Program Files\wamp\www\pract

You used double quotes for the statement, but used them within, too.

so change your line 89 to this

php Syntax (Toggle Plain Text)
  1. $add_fax_sql = "INSERT INTO fax (`master_id`, `date_added`, `date_modified`, `fax_number`, `type`) VALUES ('".$master_id."', now(), now(), '".$_POST["fax_number"]."','".$_POST["fax_type"]."')";

it now should work.

Sam
Last edited by helraizer; Apr 18th, 2008 at 10:44 am.
Reputation Points: 11
Solved Threads: 3
Light Poster
helraizer is offline Offline
48 posts
since Apr 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Parse error in code
Next Thread in PHP Forum Timeline: Generating dynamic pages on hyperlink clicks





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC