Hi thanks again!
I added those codes in, but it doesnt seem to be working, what im not getting is how to set the cookie first, and if i have to reset it etc.. heres my code at the moment:
PHP Code:
<?php
// set the cookies
setcookie("favgames", "");
$title = "My Favorite Games";
require("header.inc.php");
?>
<h1>My Favorite Games</h1>
<table>
<tr>
<?php
$cookie = explode("|", $_COOKIE['favgames']);
// cast all values to integers to make safe
array_walk($cookie, 'intval');
$list = implode(', ', $cookie);
$deleteid = $_GET['id'];
if ($_GET['a'] == "del") {
$cookie = array_diff($cookie, array($deleteid));
}
if ($_GET['a'] == "add") {
$newid = $_GET['id'];
$cookie[] = (int) $newid;
}
$query = mysql_query("SELECT id, title, description, imageurl FROM games WHERE id IN ($list) ORDER BY date DESC");
Bookmarks