I'm trying to display products on my page I was hoping to store products and their attributes in a 2d array then include them on the page and display them. This way I could add products just by editing the 2d array.
here's my 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 to display the title index [0] the picture index [8] and the price index [2]
here's myPage.php
<h3 style="margin-bottom:20px; left:10px; position:relative;"> New Women's designs and colors </h2>
<?php
include("catalog.php");
for($x =0; $x < count($varProduct); $x++ )
{
echo $varProdct[x][0];
}
?>
I get an error on the page ) Parse error: syntax error, unexpected 'array' (T_ARRAY), expecting ')' in C:\wamp\www\sparta\WomensNewArrivalCatalog.php on line 7 Call Stack
how can I display what I need to display I don't see where my syntax is wrong.
edit: after adding the comma I get a
( ! ) 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