homepage Welcome to WebmasterWorld Guest from 54.227.171.163
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Small PHP parse error please help if you can
tiger5226

5+ Year Member



 
Msg#: 3645189 posted 9:37 pm on May 8, 2008 (gmt 0)

Hello everyone I just need some help with a parse error. I am thinking is has just been worded wrong.

Parse error: parse error, unexpected '=', expecting ';' in /home/content/t/i/g/tiger5226/html/ordertracking.php on line 71

Line 71 reads below:

<?php for(x=0;x<i;x++){ ?>

Any help would be great thanks again!

Mark

 

Little_G

5+ Year Member



 
Msg#: 3645189 posted 10:05 pm on May 8, 2008 (gmt 0)

Hi,

Variables in PHP have a $ in front of them.

Andrew

tiger5226

5+ Year Member



 
Msg#: 3645189 posted 10:19 pm on May 8, 2008 (gmt 0)

So it should read:?

<?php for$(x=0;x<i;x++){ ?>

Mark

jatar_k

WebmasterWorld Administrator jatar_k us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3645189 posted 10:46 pm on May 8, 2008 (gmt 0)

try

<?php for($x=0;$x<i;$x++){ ?>

each x is an individual variable

[php.net...]

eelixduppy

WebmasterWorld Senior Member eelixduppy us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 3645189 posted 10:52 pm on May 8, 2008 (gmt 0)

There's an 'i' in there, as well ;)

<?php for($x=0; $x < $i; $x++){ ?>

jatar_k

WebmasterWorld Administrator jatar_k us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3645189 posted 10:53 pm on May 8, 2008 (gmt 0)

oops :)

tiger5226

5+ Year Member



 
Msg#: 3645189 posted 1:12 am on May 9, 2008 (gmt 0)

Ok guys I tried to correct everything but it did not work. It actually made things worse. It affected things like how the shopping cart worked and the like.

I am actually installing a widget to have buysafe bonds sold on my thank you page. Below is the full text. If you see something different please let me know and maybe I can go from there. Thank you guys so much for all the help so far. You are great!

<!-- BEGIN: buySAFE Other Platform widget -->
<script type="text/javascript" src="https://example.com/private/rollover/utils.js"></script>
<script type="text/javascript">
<!--
var buySAFE_Merchant = '<?php print $merchant_id?>';
var buySAFE_OrderNum = '<?php print $order_num?>';
// Then, for EACH ITEM in the cart, call the function buySAFE_addCartItem:
<?php for(x=0;x<i;x++){ ?>
buySAFE_addCartItem( "<?php print $itemProdName[x];?>", <?php print $itemQty[x];?>, <?php print $itemPrice[x];?>, "<?php print $itemProdID[x];?>" )
<?php } ?>
//-->
</script>
<script type="text/javascript" src="https://example.com/private/rollover/widget.js"></script>
<!-- END: buySAFE Other Platform widget -->

[edited by: eelixduppy at 2:23 am (utc) on May 9, 2008]
[edit reason] example.com [/edit]

Steerpike

5+ Year Member



 
Msg#: 3645189 posted 11:50 am on May 9, 2008 (gmt 0)

As described previously variables in php have a $ in front of them:

<?php for(x=0;x<i;x++){ ?>
buySAFE_addCartItem( "<?php print $itemProdName[x];?>", <?php print $itemQty[x];?>, <?php print $itemPrice[x];?>, "<?php print $itemProdID[x];?>" )
<?php } ?>

has multiple instances of x and i without a $ in front of them.
It should be:

<?php for($x=0;$x<$i;$x++){ ?>
buySAFE_addCartItem( "<?php print $itemProdName[$x];?>", <?php print $itemQty[$x];?>, <?php print $itemPrice[$x];?>, "<?php print $itemProdID[$x];?>" )
<?php } ?>

StoutFiles

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3645189 posted 11:56 am on May 9, 2008 (gmt 0)

$x < $i

Where are you setting the value of $i? If you don't give $i a value, this program will loop until it crashes or freezes.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved