html - what's wrong with my php syntax? -
i'm trying display products on page hoping store products , attributes in 2d array include them on page , display them. way add products editing 2d array.
here's catalog.php
<?php $varproduct = array ( // title, style, price, number of xsmalls, number of small, number of medium, number of large, number of xl, number small picture path, medium picture path, large picture path, sale array("title" , 10213 , 100, 0,0,1,1,0, "/womens/tops/s/2.png", "/womens/tops/s/2.jpg", "/womens/tops/s/2.jpg", 50 ) array("title" , 10213 , 100, 0,0,1,1,0, "/womens/tops/s/2.png", "/womens/tops/s/2.jpg", "/womens/tops/s/2.jpg", 50 ) ) ?>
i want display title index [0] picture index [8] , price index [2]
here's mypage.php
<h3 style="margin-bottom:20px; left:10px; position:relative;"> new women's designs , colors </h2> <?php include("catalog.php"); for($x =0; $x < count($varproduct); $x++ ) { echo $varprodct[x][0]; } ?>
i error on page ) parse error: syntax error, unexpected 'array' (t_array), expecting ')' in c:\wamp\www\sparta\womensnewarrivalcatalog.php on line 7 call stack
how can display need display don't see syntax wrong.
edit: after adding comma
( ! ) notice: use of undefined constant x - assumed 'x' in c:\wamp\www\sparta\mypage.php on line 101 call stack
time memory function location
1 0.0000 144880 {main}( ) ..\mypage.php:0
you missing comma "," after first index of main array , semicolon @ end of main array. here how code should like:
$varproduct = array ( array("title" , 10213 , 100, 0,0,1,1,0, "/womens/tops/s/2.png", "/womens/tops/s/2.jpg", "/womens/tops/s/2.jpg", 50 ), array("title" , 10213 , 100, 0,0,1,1,0, "/womens/tops/s/2.png", "/womens/tops/s/2.jpg", "/womens/tops/s/2.jpg", 50 ) );
[edit]: there syntax errors in other mypage.php file well. such missing $ variable x @ echo statement.
Comments
Post a Comment