Welcome to WebmasterWorld Guest from 54.145.207.36

Forum Moderators: coopster & jatar k

Small PHP parse error please help if you can

   
9:37 pm on May 8, 2008 (gmt 0)

5+ Year Member



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

10:05 pm on May 8, 2008 (gmt 0)

5+ Year Member



Hi,

Variables in PHP have a $ in front of them.

Andrew

10:19 pm on May 8, 2008 (gmt 0)

5+ Year Member



So it should read:?

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

Mark

10:46 pm on May 8, 2008 (gmt 0)

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



try

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

each x is an individual variable

[php.net...]

10:52 pm on May 8, 2008 (gmt 0)

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



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

<?php for($x=0; $x < $i; $x++){ ?>
10:53 pm on May 8, 2008 (gmt 0)

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



oops :)
1:12 am on May 9, 2008 (gmt 0)

5+ Year Member



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]

11:50 am on May 9, 2008 (gmt 0)

5+ Year Member



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 } ?>
11:56 am on May 9, 2008 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



$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.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month