Problems with creating array of associative arrays[SOLVED]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Problems with creating array of associative arrays[SOLVED]

Post by raghavan20 »

I don't really know what is the problem with the code below.

Code: Select all

<?php

				$store_array = array();

				$store_array[0] = array("name"=>"MemberId", "value"=>"NULL", "type"= "integer");
				$store_array[1] = array("name"=>"UserName", "value"=>$user_name, "type"=>"string");
				$store_array[2] = array("name"=>"Password", "value"=>$password, "type"= "string");
				$store_array[3] = array("name"=>"FirstName", "value"=>$first_name, "type"= "string");
				$store_array[4] = array("name"=>"LastName", "value"=>$last_name, "type"= "string");
				$store_array[5] = array("name"=>"Email", "value"=>$user_name, "type"= "string");
				$store_array[6] = array("name"=>"Phone", "value"=>$phone, "type"= "string");
				$store_array[7] = array("name"=>"PrivelegeId", "value"=>2, "type"= "integer");
				$store_array[8] = array("name"=>"JoinDate", "value"=>"NOW()", "type"= "integer");
				echo "<br />"; print_r($store_array);

?>
Error reported:

Code: Select all

Parse error: parse error, expecting `')'' in /home/www/letter2india.farvista.net/trial.php on line 5
Any kind of suggestion is welcome.
Last edited by raghavan20 on Thu Nov 03, 2005 7:19 pm, edited 1 time in total.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Re: Problems with creating array of associative arrays

Post by timvw »

raghavan20 wrote:

Code: Select all

$store_array[0] = array("name"=>"MemberId", "value"=>"NULL", "type"= "integer");
A couple of simple typos... missing >

$store_array[0] = array("name"=>"MemberId", "value"=>"NULL", "type"=> "integer");
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

Thanks timvw, that solved the problem.
Post Reply