Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

A simple newbie question

 
   Database Forums (Home) -> PHP RSS
Next:  Music on USB  
Author Message
typingcat

External


Since: Oct 22, 2005
Posts: 1



(Msg. 1) Posted: Sat Oct 22, 2005 3:08 am
Post subject: A simple newbie question
Archived from groups: comp>lang>php (more info?)

Hello. I started writing PHP today.
I added the following code at a php page.
<?php
if($_SESSION["dbpwd"]=="")
{
print("EMPTY!");
$_SESSION["dbpwd"]="TEST";
print(" SET TO ".$_SESSION["dbpwd"]);
}
else
{
print($_SESSION["dbpwd"]);
}
?>
I thought if I refreshed the page, then dbpwd would set to "TEST" and
"TEST" would be displayed. But it didn't work. What's wrong? I'd like
to keep some variables that only are good for the sessioin.

 >> Stay informed about: A simple newbie question 
Back to top
Login to vote
jkimball4

External


Since: Oct 23, 2005
Posts: 1



(Msg. 2) Posted: Sun Oct 23, 2005 1:46 pm
Post subject: Re: A simple newbie question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

check your php.ini settings for sessions. if all seems to be okay then
make sure you are initializing sessions at the start of your php
scripts. like...session_start() or equivilent function. also check
how your sessions are being saved (on the server, cookies). if
cookies, check browser settings to make sure you are allowing cookies
to be saved on your machine.

wrote:
> Hello. I started writing PHP today.
> I added the following code at a php page.
> <?php
> if($_SESSION["dbpwd"]=="")
> {
> print("EMPTY!");
> $_SESSION["dbpwd"]="TEST";
> print(" SET TO ".$_SESSION["dbpwd"]);
> }
> else
> {
> print($_SESSION["dbpwd"]);
> }
> ?>
> I thought if I refreshed the page, then dbpwd would set to "TEST" and
> "TEST" would be displayed. But it didn't work. What's wrong? I'd like
> to keep some variables that only are good for the sessioin.

 >> Stay informed about: A simple newbie question 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Newbie needs help with simple error from textbook - Hello, I'm using the book "Beginning PHP4" (Wrox) to learn PHP5. I have PHP Version 5.0.5 installed, running on Win XP pro SP2 with IIS. On page 265-269 3 files are described. The first menu1.php posts the value of a combo box to menu2.php. T...

Simple question - Here is the problem I have. I have added a management interface in php for a website that was all html and flash. Whereas before items were hard-coded, now they are pulled up from a database. I can change the links from html to php almost..

simple grep question - I want to do the following: replace __abc__ with <b>abc</b> in a string Any help? Ben

Simple (?) Singleton Question - Hey all - Not being a seasoned PHP developer, tonight I started playing with the use of the Singleton pattern to store configuration information. What I was surprised to find was that the instance - at least the one I'm creating - isn't really a..

Hopefully Simple Question re Variables - I'm learning PHP so this might be a simple question to more expeienced developers hopefully. I have a findrecords.php page which has the following code which creates a new record in a database table if this is the first time the user performs a ..
   Database Forums (Home) -> PHP All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]