Jump to content

Doesn't Work!


Dysan

Recommended Posts

Why doesn't the following code work?, I keep getting greeted with the following error message:

 

Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in C:\Documents and Settings\User\Desktop\Xampp\htdocs\1.php on line 7.

 

<?php

session_start();

if (array_key_exists($_GET['id'], $array))
{
  echo "Already Exists!";
}
else
{
  $_SESSION['ids'][] = $_GET['id'];
  $array = $_SESSION['ids'];
}

print_r($array);

?> 

Link to comment
https://forums.phpfreaks.com/topic/78311-doesnt-work/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.