bradgrafelman;10999705 wrote:I don't really understand your description at all, but would using an [man]array[/man] be more appropriate here? Example..
$data = array(
array(
'pid' = 2,
'parent' = 2,
'name?' = 'Barter / Rental'
),
array(
'pid' = 3,
'parent' = 6,
'name?' = 'Business'
),
// etc.
);
Okay I get this and you are right an array is what I needed thanks. I tried to make my code work with this and was not successful. Basically the main category in the db is Barter / Rental and under sub categories I have equipment and other. To use the sub categories can I do this for the array assignment.
$data = array(
array(
'pid' = 2,
'parent' = 2,
'ref' = 'Barter / Rental' => 'Equipment', => 'Other'
),
What I am trying to accomplish is when the url shows ?ref='' Barter / Rental, Equipment, or Other I can pull in the pid or parent ID from the db? Do I have this array code correct?
OR after hours of goggling should I do this below
$data['Barter / Rental'] = array('cid' => 2, 'parent' => '2');
$data['Equipment'] = array('cid' => 2, 'parent' => '2');
$data['Other'] = array('cid' => 2, 'parent' => '2');
if (in_array($_GET['ref'], $data)){
foreach($array as $key => $value) {
if ($value['parent'] === 'cid') { //Not sure if I got this line right.
return $key;
}
}
Any help will be gladly appreciated.