Jump to content

PHP Shopping Cart without Database


mikhl

Recommended Posts

For a project I have to create a simple form that allows a user to order a pair of trainers. I understand how to do as the project outlines, but would like to expand on it.

 

Would it be possible for me to substitute a MySQL database for an array that contains an array of products. So that when the user makes an order, the quantity in the array is reduced.

 

The array would look as follows:

 

$prod = array(

array(
	'id' => '00001',
	'name' => 'Pink Converse',
	'desc' => 'This is the description of the product.',
	'price' => 4500,
	'quantity' => 2,
	'img' => 'images/prod1.jpg',
	'img2' => 'images/00001-2.jpg'
	),


array(
	'id' => '00002',
	'name' => 'Tartan Nike Hi-Tops',
	'desc' => 'This is the description of the product.',
	'price' => 5500,
	'quantity' => 2,
	'img' => 'images/prod2.jpg',
	'img2' => 'images/00002-2.jpg'
	),

array(
	'id' => '00003',
	'name' => 'Black Hi-Tops',
	'desc' => 'This is the description of the product.',
	'price' => 5500,
	'quantity' => 2,
	'img' => 'images/prod3.jpg',
	'img2' => 'images/00003-2.jpg'
	),

array(
	'id' => '00004',
	'name' => 'Smart Mens Shoes',
	'desc' => 'This is the description of the product.',
	'price' => 7000,
	'quantity' => 2,
	'img' => 'images/prod3.jpg',
	'img2' => 'images/00004-2.jpg'
	)

);

 

If you know if this is possible or not, you would be a great help, any ideas would also be welcome.

 

Thanks :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.