Run the setcookie code, and open the folder where your browser stores its
cookies. Look for your cookie and see it whats in it is what you expect.
Another suggestions is to echo out the code before you execute it to see if
the values you expected are there
echo "setcookie ('USERcookie', "$user");";
Bastien
From: "Jason T. Davidson" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Cookies with databases
Date: Thu, 21 Oct 2004 22:38:02 -0500
Bastien-
I took out the quotes (as I noticed after the fact that I didn't need them)
however this did not help.
"is the user cookie set" This I do not know as I am trying to test this on
that second page. I get nothing, so I am assuming that it isn't set,
however the first one $cid is working just fine, but it's variable doesn't
come from a database.
--
Jason Davidson
Bastien Koert wrote:
Hi Jason,
1. I don't think you need the quotes around the values.
2. is the user cookie set?
bastien
From: "Jason T. Davidson" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Cookies with databases
Date: Wed, 20 Oct 2004 19:54:54 -0500
I am trying to set a cookie with a value from a database. Here is my
script:
<? //Setting Cookies
setcookie ('CIDcookie', "$cid");
setcookie ('USERcookie', "$user");
?>
<?
//Database connection
require ("../../db_connect.php");
//Table Name
$main_tbl = "MAIN"
?>
<?
//Check the Password against the CID
$query="SELECT * FROM $main_tbl WHERE CID='$cid'";
$result=mysql_query($query) or die(mysql_error());
$check=mysql_fetch_array($result);
if ($Message == "NoAccess"){
echo("<B><CENTER><FONT COLOR=RED>You do not have access to that
page!</FONT></CENTER></B>\n");
include ("staff_code/admin_links.php");
}
if ($check[PASSWORD] != $_REQUEST[password]){
header("Location:staff_login.php?Message=Invalid");
}
if (($check[PASSWORD] == $_REQUEST[password]) AND ($check[USER] ==
"A")) {
include ("staff_code/admin_links.php");
$user = $check[USER];
}
else{
include ("staff_code/controller_links.php");
}
?>
Then on the second page it is reading the cookies, but it will display
the CIDcookie, but not the USERcookie. Here is the script on the second
page:
<? //Retrieve Cookies
$cid = $_COOKIE['CIDcookie'];
$user = $_COOKIE['USERcookie'];
?>
<html>
<head>
<title>ZMP ARTCC: Staff To Do List</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<?
echo ("My CID is $cid");
echo ("$user");
?>
<body text="#000066" link="#000066" vlink="#000066" alink="#000066">
<table width="600">
<tr>
<td><div align="center"><font size="4"><strong>ZMPs Staff TO Do
List</strong></font></div></td>
</tr>
</table>
<br>
<table width="600">
<tr>
<td colspan="3" bgcolor="#999999"><div
align="center"><strong><font size="3">Completed
Tasks</font></strong></div></td>
</tr>
<tr bgcolor="#CCCCCC">
<td width="100"><div align="center">Date Finished</div></td>
<td width="250"><div align="center">Task</div></td>
<td width="250"><div align="center">Status</div></td>
</tr>
<tr>
<td><div align="center">10-13-04</div></td>
<td><div align="center">DLH SOP (new)</div></td>
<td><div align="center">Awaiting finish of other
projects</div></td>
</tr>
<tr>
<td><div align="center">10-18-04</div></td>
<td><div align="center">ZMP Policies</div></td>
<td><div align="center">"</div></td>
</tr>
</table>
<br>
<table width="600">
<tr>
<td colspan="3" bgcolor="#999999"><div
align="center"><strong><font size="3">
Tasks Awaiting VATUSA
Approval</font></strong></div></td>
</tr>
<tr bgcolor="#CCCCCC">
<td width="100"><div align="center">Date Sent</div></td>
<td width="250"><div align="center">Task</div></td>
<td width="250"><div align="center">Status</div></td>
</tr>
<tr>
<td><div align="center">10-09-04</div></td>
<td><div align="center">LNK SOP (new)</div></td>
<td><div align="center">Awaiting approval</div></td>
</tr>
<tr>
<td><div align="center">10-19-04</div></td>
<td><div align="center">M98 SOP</div></td>
<td><div align="center">Awaiting Approval</div></td>
</tr>
<tr>
<td><div align="center">10-19-04</div></td>
<td><div align="center">General SOP</div></td>
<td><div align="center">Awaiting Approval</div></td>
</tr>
</table>
</body>
</html>
So I am assuming that somewhere in my first page that my cookie isn't
actually gettting set properly. I have tried many varitites and can't
find any help sections on cookies from a database. Any help would be
appreciated!
--
Jason Davidson
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php