A Parse Error Problem

Pages: 1, 2, 3
free web hosting

Read Latest Entries..: (Post #20) by shadowdemon on Apr 2 2006, 01:48 AM. (Line Breaks Removed)
Well i asked a old firend of mine on another site to help and he figured it out.
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Open Discussion > Have your say > Support and Feedback > Questions & Queries

A Parse Error Problem

shadowdemon
CODE

<?php include ("header.php");
echo "<br>Welcome to the construction site. Randomly we will update this place with stuff you can do. Currently we are offering you to make a building where you can make trade gold for ap or platinum for ap. The cost of this project is all 10k silver wood.</br>";

if ($stat[construction] <= 1)
{
print 'Would you like to start the building';
echo "<a href="construction.php?action=construct">construct</a> ";
)
if ($action == construct)
{
print "you have started construction $stat[user]...<br><br>";
mysql_query("Update players Set construction=yes where id=stat[id] ");
//a verification should be made if the player has the right amount of silver wood before making that query
//else you'll end up with - numbers..
mysql_query("Update players Set silver wood = $stat[silverwood]-10000 where stat[id] ");
mysql_query("Update players Set construction = stat[construction]+1 where stat[id] ");
print "</table><br>";
print "Or you can always... <a href=city.php>go back</a>.";
}
}
if ($stat[constructed] => 2)
{
$prices = mysql_query("select * from market");
$pa = mysql_fetch_array($prices);
$plat_price = $pa[ap];
if ($action != buy) {
print "Ap isn't always a stable-priced commodity... right now its $plat_price credits an ap. How much you want?";
print "<form method=post action=construction.php?action=buy>";
print "I want <input type=text name=plat> ap. <input type=submit value=Buy>";
print "</form>";
} else {
$plat = str_replace("--","", $plat);
$cost = ($plat * $plat_price);
if ($cost > $stat[credits] || $plat <= 0) {
print "You cant afford that! (<a href=pshop.php>back</a>)";
} else {
mysql_query("update players set credits=credits-$cost where id=$stat[id]");
mysql_query("update players set ap=ap+$plat where id=$stat[id]");
print "You got <b>$plat</b> ap for <b>$cost</b> credits.";
}
}

?>

<? include ("footer.php"); ?>


and the error is

QUOTE

Parse error: parse error, expecting `','' or `';'' in /home/www/dancha42.madpage.com/construction.php on line 7


if thes dont show up as quotes could a mod fix it please.



this is for a text based game so it may seem different. But it shouldnt matter since the parse error shouldnt interfer with it.

 

 

 


Reply

jlhaslip
What you have currently:
CODE

if ($stat[construction] <= 1)
{
print 'Would you like to start the building';
echo "<a href="construction.php?action=construct">construct</a> ";
)

And what you might need to change is the last end parenthesis to a right-curly brace. Like this:
CODE

if ($stat[construction] <= 1)
{
print 'Would you like to start the building';
echo "<a href="construction.php?action=construct">construct</a> ";
}

Reply

Tyssen
This line:

CODE
echo "<a href="construction.php?action=construct">construct</a>";

should be:
CODE
echo '<a href="construction.php?action=construct">construct</a>';

or:
CODE
echo "<a href=\"construction.php?action=construct\">construct</a>";

PHP is going to execute anything within the " " or ' ' so in your case, it gets to the " after the href and then stops.

Reply

shadowdemon
now i get this
Parse error: parse error in /home/www/dancha42.madpage.com/construction.php on line 20

i hate parse errors. im gonna try and figure it out myself but if you what to fix your suggestions are welcomed

Reply

jlhaslip
you have :

CODE
if ($stat[constructed] => 2)


try:

CODE
if ($stat[constructed] >= 2)




Reply

shadowdemon
QUOTE(jlhaslip @ Apr 1 2006, 10:43 AM) *

you have :

CODE
if ($stat[constructed] => 2)


try:

CODE
if ($stat[constructed] >= 2)



doesnt fix the parse error but that is becuase it isnt on line 20 so you might have fixed a later parse error but i still need some help with the line 20 one

Reply

jlhaslip
It might not like the whitespace and carriage return here:
CODE
if ($action == construct)
{
print "you have

Try this for the If statements:
CODE
if ($action == construct) {
print "you have



Reply

truefusion
On line 2, the <br> tag doesnt work like that.

And for this:
QUOTE
if ($stat[construction] <= 1)
{
print 'Would you like to start the building';
echo "<a href=\"construction.php?action=construct\">construct</a> ";
)

I think the thing in bold is the problem. May want to change it to: }

Reply

shadowdemon
QUOTE(truefusion @ Apr 1 2006, 12:28 PM) *

On line 2, the <br> tag doesnt work like that.

And for this:

I think the thing in bold is the problem. May want to change it to: }

fixed that earlier


QUOTE(jlhaslip @ Apr 1 2006, 12:17 PM) *

It might not like the whitespace and carriage return here:
CODE
if ($action == construct)
{
print "you have

Try this for the If statements:
CODE
if ($action == construct) {
print "you have




ill try this out ty

i thought spaces dont matter in php
yeah i was right spaces dont matter cause i still get

Parse error: parse error in /home/www/dancha42.madpage.com/construction.php on line 19 (was 20 but then the space made it drop down one)


the error is around here

mysql_query("Update players Set silver wood = $stat[silverwood]-10000 where stat[id] ");
mysql_query("Update players Set construction = stat[construction]+1 where stat[id] ");
print "</table><br>";
print "Or you can always... <a href=city.php>go back</a>.";
}
}
if ($stat[constructed] >= 2)

but i dont see what is wrong (match this up with the code but it is around this area more specifically print "</table<br>";)

 

 

 


Reply

jlhaslip
QUOTE(shadowdemon @ Apr 1 2006, 11:16 AM) *

fixed that earlier
ill try this out ty

i thought spaces dont matter in php
yeah i was right spaces dont matter cause i still get

Parse error: parse error in /home/www/dancha42.madpage.com/construction.php on line 19 (was 20 but then the space made it drop down one)

Sometimes an editor will plant invisible things in there. I happen to have an Editor which shows the carriage returns and tabs, etc so I thought maybe there was something out of place perhaps.

You have changed the code a little bit to fix some previous errors. Would you mind re-posting the code and please identify the error line for us. PHP is funny about parse errors. It identifies a line by number where it senses the error, but it might be several lines back that the actual cause exists.

Reply

Latest Entries

shadowdemon
Well i asked a old firend of mine on another site to help and he figured it out.

Reply

truefusion
Try this:
CODE

<?php

include ("header.php");

echo "Welcome to the construction site. Randomly we will update this place with stuff you can do. Currently we are offering you to make a building where you can make trade gold for ap or platinum for ap. The cost of this project is all 10k silver wood.";

if ($stat[construction] <= 1){
print "Would you like to start the building";
echo "<a href=\"construction.php?action=construct\">construct</a>";
}
if ($action == "construct"){
print "you have started construction $stat[user]...<br /><br />";
mysql_query("Update players Set construction=yes where id=stat[id]");
//a verification should be made if the player has the right amount of silver wood before making that query
//else you'll end up with - numbers..
mysql_query("Update players Set silver wood = $stat[silverwood]-10000 where stat[id]");
mysql_query("Update players Set construction = stat[construction]+1 where stat[id]");
print "</table><br />";
print "Or you can always... <a href=\"city.php\">go back</a>.";
}

if ($stat[constructed] >= 2){
$prices = mysql_query("select * from market");
$pa = mysql_fetch_array($prices);
$plat_price = $pa[ap];
if ($action != "buy") {
print "Ap isn't always a stable-priced commodity... right now its $plat_price credits an ap. How much you want?";
print "<form method=\"post\" action=\"construction.php?action=buy\">";
print "I want <input type=\"text\" name=\"plat\"> ap. <input type=\"submit\" value=\"Buy\">";
print "</form>";
}
else {
$plat = str_replace("--","", $plat);
$cost = ($plat * $plat_price);
if ($cost > $stat[credits] || $plat <= 0) {
print "You cant afford that! (<a href=\"pshop.php\">back</a>)";
}
else {
mysql_query("update players set credits=credits-$cost where id=$stat[id]");
mysql_query("update players set ap=ap+$plat where id=$stat[id]");
print "You got <b>$plat</b> ap for <b>$cost</b> credits.";
}
}
}

include ("footer.php");

?>

Reply

shadowdemon
QUOTE(truefusion @ Apr 1 2006, 04:39 PM) *

CODE

if ($action == construct) {

Put quotes around construct, see if that helps. Cause unless construct is a constant, it would need quotes, i guess.

And if that doesnt help, have you tried echo, rather than, print?



with echo it doesnt work and with quotes it doesnt. Im getting so mad at this script. ARGGGH why wont it work.

Reply

truefusion
CODE

if ($action == construct) {

Put quotes around construct, see if that helps. Cause unless construct is a constant, it would need quotes, i guess.

And if that doesnt help, have you tried echo, rather than, print?

Reply

shadowdemon
QUOTE(jlhaslip @ Apr 1 2006, 02:44 PM) *

CODE

print "Or you can always... <a href=city.php>go back</a>.";

Remove the period at the end of this line and see if that works. It might be trying to concatenate something there???

*edit* Browser troubles, fixing it up...



no still parse error
sry about taking so long boredom troubles

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Pages: 1, 2, 3
Similar Topics

Keywords : parse error

  1. Awstats Not Working - Getting an error with awstats (1)
  2. Problem With Uploading My Website - my be conection error, or ftp (10)
    i am using Absolute ftp client , but that i can not able to conect, i have tried a lot but no
    responce, suggest me which ftp is good, and how i can upload my website. is that ftp id is
    currect ? ( ftp.capitalheat.biz )...
  3. Transfering Credits [resolved] - error (6)
    When i try to transfer credits to BANK (for awardz and other stuff later) i get: Credits to
    transfer : 5 Credits With 3% Tax : 5.15 You must have more than to transfer But i have 11 days
    which mean about 11 credits O_o. Why do i get that error? am i not allowed to transfer credits when
    i get hosted? If i can how do i do it?...
  4. Web Hosting Error - ? (3)
    Processing.. Please wait!. Do not hit RELOAD or BACK.. Username Validated. Connecting to
    Database... Database Connection Established. Validating username and password.. Username Validated.
    Checking permissions.. Permission granted. Preparing data for Creating Account.. Approved for
    trap17_Beta.. Checking, if username is unique. Username seems to be unique. All Data Confirmed.
    Account information Ready. Stand-by, Trying to connect to server and create account.. This might
    take very long time. Please be patient... CREATING ACCOUNT... REQUEST SENT. WAITING FOR REPLY......
  5. I Could Not Request For Free Web Hosting - reporting an error, when tried to request for free web hosting (3)
    I could not send a request to host a new free web hosting, after accumulating enough credits from
    forum postings. And I get the following error. QUOTE Sorry, an error occurred. If you are
    unsure on how to use a feature, or don't know why you got this error message, try looking
    through the help files for more information. The error returned was: Our records indicate that
    you have already submitted an application. Please wait until that application is approved or denied
    before submitting another one. And my previous request was denied due to lack of forum...
  6. Msql Error Message - (5)
    Can anyone make sense of this? Its not a Trap17 problem by the way. QUOTE Warning :
    mysql_connect(): Host 'neo.**********.com' is blocked because of many connection errors.
    Unblock with 'mysqladmin flush-hosts' in /home/*****/public_html/inc/connectdb.php on line
    2 Warning : mysql_select_db(): Access denied for user: 'nobody@localhost' (Using
    password: NO) in /home/******/public_html/inc/connectdb.php on line 3 Warning :
    mysql_select_db(): A link to the server could not be established in
    /home/******/public_html/inc/connec...
  7. Error With [my Assistant] Link - (4)
    This is what comes up when I click for my assistant. It seems to be an overlay of some
    kind and the text lines scroll on and on. This represents only the first thing that it says. As
    you can see it blocks my access to everything by my last 10 posts including the ability to close it
    down or move it. It only disappears when I change pages. Does anybody have a clue? ...
  8. Getting Error Whwn Trying To Change My Domain Name - thru trap 17 (0)
    i am getting theis erroro bellow QUOTE Warning: mysql_real_escape_string(): Access denied for
    user: 'nobody@localhost' (Using password: NO) in
    /home/trap17/public_html/process/changedomain.php on line 71 Warning: mysql_real_escape_string(): A
    link to the server could not be established in /home/trap17/public_html/process/changedomain.php on
    line 71 Warning: mysql_real_escape_string(): Access denied for user: 'nobody@localhost'
    (Using password: NO) in /home/trap17/public_html/process/changedomain.php on line 72 Warning:
    mysql_real_escape_string(): ...
  9. Another Parse Error - lol (11)
    CODE <?php $title = "Forums"; include("header.php"); ?>
    <?php // the Topic List if ($view == topics) {     print
    "<table><tr><td
    width=150><u><b>Topic</td><td
    width=100><u><b>Starter</td><td
    width=50><b><u>Replies</td></tr>";     $tsel =
    mysql_query("select * from topics2");     while ($topic =
    mysql_fetch_array($tsel)) {         $rep...
  10. Ftp Error - help :( (2)
    I got this error when i try to upload my FTP client, it says all is right except this 421 Unable to
    setup secure anynomous FTP can anyone help, i need to get my website rolling -Laos...
  11. Free Regestration Error - and error on generating code (5)
    when i try and generate the code to post in the free regestration area it wont let me... it gives me
    File not acquired! ...
  12. Error Page - my site isn't coming up (10)
    for about 2 days now i have had this problem. when i go to my site www.conret.com a Forbidden page
    comes up. I donk know why. Can anyone tell me?...
  13. I Got An Error - help (2)
    QUOTE Username Validated. Connecting to Database... Database Connection Established. Validating
    username and password.. Username Validated. Checking permissions.. Permission granted. Preparing
    data for Creating Account.. Approved for trap17_Alpha.. Checking, if username is unique. Username
    seems to be unique. All Data Confirmed. Account information Ready. Stand-by, Trying to connect to
    server and create account.. This might take very long time. Please be patient... CREATING ACCOUNT...
    REQUEST SENT. WAITING FOR REPLY... REPLY RECIEVED. VALIDATING DATA There were prob...
  14. Web Hosting Account Error - (2)
    I am not sure if i am suposed to post this in this fourm so if I am wrong pleese exuse me. When i
    am trying to register my site for web hosting it gives me this error and it sais somone is using
    this website and I dont think that is true since the site is mine and I never registered it for
    webhosting with trap17. I hope you can fix this problem soon so I can work on my site.
    THANK YOU,
    conret QUOTE Printing Debug In...
  15. Registration Error? - why can't i registrate? (11)
    "File not aquired"??? Ok,this seems to be a problem,i tried twice to registrate on trap17 and twice
    there was the same error,after filling this application.What do i do wrong?...
  16. Awstats Error - (2)
    Hmm there seem's to be a file path error when trying to check my web stats . Error Message
    Error: Couldn't open config file "awstats.n-name.be.conf" nor "awstats.conf" after searching in
    path ".,/home/xrated/tmp/awstats/,/etc/opt/awstats,/etc/awstats,/etc,/usr/local/etc/awstats": No
    such file or directory - Did you use the correct URL ? Example:
    http://localhost/awstats/awstats.pl?config=mysite Example:
    http://127.0.0.1/cgi-bin/awstats.pl?config=mysite - Did you create your config file
    'awstats.n-name.be.conf' ? If not, you can run "./../../tools...
  17. "you Are Suppposed To Get Approved For Hosting..." - error message - please help (5)
    QUOTE Processing.. Please wait!. Do not hit RELOAD or BACK.. Username Validated. Connecting
    to Database... Database Connection Established. Validating username and password.. Username
    Validated. Checking permissions.. Permission granted. Preparing data for Creating Account.. You are
    suppposed to get approved for Hosting by ADMINISTRATORs. You are suppposed to get approved for
    Hosting by ADMINISTRATORs what now? please help!!!! do i have my website or
    not? Quote stuff you copied from other webpages and make titles as descriptive as possible...
  18. Google Search Engine Error - within TRAP17's search (2)
    OpaQue, Our 2 members have noticed that the Google serach engine embedded to TRAP17 isn't
    working: QUOTE Forbidden Your client does not have permission to get URL
    /custom?domains=trap17.com&q=welcome&sa=Search&sitesearch=&client=pub-1302819251043479&forid=1&ie=IS
    O-8859-1&oe=ISO-8859-1&cof=GALT%3A%23008000%3BGL%3A1%3BDIV%3A%233366CC%3BVLC%3A663399%3BAH%3Acenter%
    3BBGC%3AFFFFFF%3BLBGC%3AFFFFFF%3BALC%3A0000CC%3BLC%3A0000CC%3BT%3A000000%3BGFNT%3A7777CC%3BGIMP%3A77
    77CC%3BLH%3A55%3BLW%3A150%3BL%3Ahttp%3A%2F%2Fwww.google.com%2Fimages%2Flogo_sm.gif%3BS%3Ahttp%3A%2F%
    2F%3B...
  19. Error In Sql Database! - (1)
    Just tryit http://web4kids.info/forums I can't login using phpmyadmin or anything. I never
    backed up. HELP ME!...
  20. Ftp/cpanel Error - (1)
    When I delete forum from cpanel its still on my ftp and I can delete it from there.I dont know if
    the other sqls are like that....
  21. You Are Suppposed To Get Approved For Hosting - Error help. (7)
    Ok i finaly got my 30 credits, and decided to oder hosting, and got through it all and it now says
    QUOTE Processing.. Please wait!. Do not hit RELOAD or BACK.. Username Validated. Connecting
    to Database... Database Connection Established. Validating username and password.. Username
    Validated. Checking permissions.. Permission granted. Preparing data for Creating Account.. You are
    suppposed to get approved for Hosting by ADMINISTRATORs. You are suppposed to get approved for
    Hosting by ADMINISTRATORs.faith faith **.***.**.** Does that mean i need to wiat? or ...
  22. Uploading Error - (9)
    After I uploaded a large number of files to my host, I cannot get back those files. The sizes of the
    files are correct, however, they became invalid file formats.. All the files are affected, except
    html files... Java applets, flash, pictures, videos, sound, all become junk files.. Can I know
    what's happening ? I uploaded via ftp and web......
  23. Error? - (0)
    Could not obtain matched posts list QUOTE DEBUG MODE SQL Error : 1030 Got error 134 from
    table handler SELECT m.post_id FROM search_wordlist w, search_wordmatch m WHERE w.word_text LIKE
    'password' AND m.word_id = w.word_id AND w.word_common 1 Line : 337 File : search.php
    CODE [b]note from serverph to badimage:[/b] all posts are reviewed before
    hosting is approved, and it may affect your standing if non-quality posts are found, or if an
    attempt is made to "cheat" the system by not using appropriate tags to inflate ...
  24. Error With Board? - (1)
    I get the following crap every tenth or so I load the forums. Any insight on to whatever the Hell
    this is? (pardon such a long damn error) CODE /* * Cascading Style Sheet(CSS 467), for
    Invision Power Board 2.0.0 * Author: James A. Mathias, admin@leihu.com,
    [url=http://www.1lotus.com]http://www.1lotus.com[/url] * Copyright: 2004
    Invision Power Services, all rights reserved * * All style attributes in alpha-numeric order
    starting from 0 * */ /* * ======================================== * global element styles *
    ==============...
  25. Banners And Tracker Error - (4)
    hello and how are you evryone I dunno where to post this I have seen a banner error page cannot be
    displayed and also there is that tracker error there is no picture and also the website doesn't
    work once i click on it. /sad.gif' border='0' style='vertical-align:middle' alt='sad.gif' /> ...
  26. Registration Error - (1)
    I got accepted for the freewebhost and I went off to the Process link and created an account. And
    this is the error message I got: CODE Processing.. Please wait!. Do not hit RELOAD or BACK..
    Username Validated. Connecting to Database... Database Connection Established. Validating username
    and password.. Username Validated. Checking permissions.. Sorry! You are cannot signup for a
    hosting Package! Actually, when I hit submit for the first time the page didn't quite
    load properly. I mean it was taking way too much time (23 minutes to be precise), ...
  27. Phpbb Critical Error. - o.o (2)
    This cannot be good...this is what I get when I try to connect to my website...I need to see my
    Cpanel phpBB : Critical Error Could not connect to the database Any suggestions?...
  28. Mysql Phpbb Critical Error? - (4)
    Warning: mysql_connect(): Too many connections in /home/ill/public_html/void/db/mysql4.php on line
    48 Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in
    /home/ill/public_html/void/db/mysql4.php on line 330 Warning: mysql_errno(): supplied argument is
    not a valid MySQL-Link resource in /home/ill/public_html/void/db/mysql4.php on line 331 phpBB :
    Critical Error Could not connect to the database Can anyone tell me what this error is? I've
    got it before but it somehow fixed itself but now it's back??...
  29. Cgi Error - (0)
    I've been tring to fix this problem since I've had hosting here at trap17, but I can't
    do it, so I need your help. Two of my cgi scripts aren't working right. The SAME cgi script
    worked right on another host. All I did was change the location of my data files, and it messed up.
    I looked to see if the data files was right at least 10 times, but it would have given an error if
    it couldn't find the file. I'm getting an Error 500. The Error Log showed this message:
    Premature end of script headers: /home/hamtaro/public_html/cgi-bin/hamtaro_petitio...
  30. Posting Count Error? - (4)
    Hey i need help over here i think that there is a error/bug in the forums and tht occured today...i
    have 30 posts and it shows as 26 posts?...like i counted my posts by going to my profile and
    literally counting it cuz when i post 2 messages..it adds 1...just do a post count and see it for
    urself..i think there is a error in the forums
    http://www.trap17.com/forums/search&nav=au...posts&hl=&st=25 ...



Looking for parse, error, problem

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for parse, error, problem

*MORE FROM TRAP17.COM*
advertisement



A Parse Error Problem



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE