How to create/save a session array and then test a record if it exist in that session array

I am trying to save some records in a session array, how do I create a session array? and how to I save the data into the array and then compare the data in that array.
thanks
awarraicAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

steezyCommented:
Start a session with session_start();
The $_SESSION[] array is a superglobal so it is always created for you. All you need to do is add keys like this: $_SESSION['something'] = "something";

On every page that you are going to use anything from the $_SESSION array you first need to do a session_start();
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nplibCommented:
<?php
session_start();
$_SESSION['myownsessionname'] = "What ever value I want to give it";
?>

comparing the values in the sessions is up to you,
you have to know what you are comparing for, are you looking for matching string, numbers, how many sessions there are a lot of variables.
0
awarraicAuthor Commented:
I am getting this error when I compare the data:
Warning: in_array() [function.in-array]: Wrong datatype for second argument in D:\Web\vhosts\dev\mark.php on line 11

Here's how I am saving the data into the array on page one:
while($row = mysql_fetch_array($rs))
{
$_SESSION['mark_array'] = $row["mark_id"];
}

Here's how I am comparing the data on page two:
if (in_array($mark_id, $_SESSION['mark_array'])) echo "not in array";

Any clues? why it's giving that error above
0
awarraicAuthor Commented:
Still stuck, help please
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.