473,800 Members | 2,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to call the session variable?

Hi,

As you have recommended I did not use the session_registe r(). In one
file I have executed such line:
$_session['ex'] = 2.0;

Then, in another file, I have executed the following line:
$ex = 3.0.

And than I have noticed that the previous assignment is seen
everywhere (on other pages). So, as far as I understood, after the
usage of $_session['ex'] = 2.0, the $ex variable becomes a session
variable. Moreover, $ex and
$_session['ex'] variables are the same variable! In other words, I
have to call $_session['ex'] just the first time. After I did it once
I can use just $ex (instead of $_session['ex']). Is that true?
Jan 14 '08 #1
34 5613
Kurda Yon wrote:
Hi,

As you have recommended I did not use the session_registe r(). In one
file I have executed such line:
$_session['ex'] = 2.0;

Then, in another file, I have executed the following line:
$ex = 3.0.

And than I have noticed that the previous assignment is seen
everywhere (on other pages). So, as far as I understood, after the
usage of $_session['ex'] = 2.0, the $ex variable becomes a session
variable. Moreover, $ex and
$_session['ex'] variables are the same variable! In other words, I
have to call $_session['ex'] just the first time. After I did it once
I can use just $ex (instead of $_session['ex']). Is that true?
No. $_SESSION['ex'] (NOT $_session['ex'] - case IS important!) just
sets the value in the array. Nothing more, nothing less.

$ex is a completely different variable, completely unrelated to the
value in the $_SESSION array.

It's no different than having $abc and my_array['abc']. Two entirely
different variables.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Jan 14 '08 #2

"Jerry Stuckle" <js*******@attg lobal.netwrote in message
news:7L******** *************** *******@comcast .com...
Kurda Yon wrote:
>Hi,

As you have recommended I did not use the session_registe r(). In one
file I have executed such line:
$_session['ex'] = 2.0;

Then, in another file, I have executed the following line:
$ex = 3.0.

And than I have noticed that the previous assignment is seen
everywhere (on other pages). So, as far as I understood, after the
usage of $_session['ex'] = 2.0, the $ex variable becomes a session
variable. Moreover, $ex and
$_session['ex'] variables are the same variable! In other words, I
have to call $_session['ex'] just the first time. After I did it once
I can use just $ex (instead of $_session['ex']). Is that true?

No. $_SESSION['ex'] (NOT $_session['ex'] - case IS important!) just sets
the value in the array. Nothing more, nothing less.

$ex is a completely different variable, completely unrelated to the value
in the $_SESSION array.

It's no different than having $abc and my_array['abc']. Two entirely
different variables.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jan 14 '08 #3
What an idiot! He tested and they are related - that's a fact. How many
times I told you in other threads the same thing?

I have never called you an idiot in those other threads, but finally there
is a limitation. It's okay to be an idiot, but don't come to this forum to
confuse others.

Jan 14 '08 #4
Your observationb is absolutely accurate!

Yes, you are can use either $_SESSIN["a"] and $a, and they mean the same
thing when globals are registered.

Have said that, it does not mean that I promote it, on the contrary, I have
to tell you that it is absolutely a bad practice, and I expect that this
magic will go away entirely.

Jan 14 '08 #5
How long have you been using PHP? I only started to read my first PHP book
last weekend. Oh man, you are kidding me... That's why Hillary's experience
argument is so weak.

Jan 14 '08 #6
Trust yr own testing and judgement first, and be very careful what you hear
in this forum.

Jan 14 '08 #7
If your knowledge violates testing result, go update your knowledge, don't
dig deeper.

Jan 14 '08 #8
the OP has been diligently testing and trying, and the best you can do is to
dis his ideas with baseless words. God bless the OP.

Jan 14 '08 #9
I should have been nicer. There was no point to lash out on you just because
you didn't know things. Peace!

But facts are facts. Go learn more about session, to be precise how php
handles it. Learn before start teaching.

Jan 14 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
1823
by: Shelly | last post by:
I set a session variable on error in the login page and then call the login page again. I test on that session variable but it shows as not set. I checked with an echo immediately after setting the error session variable so I am 100% positive that it is set. The recursive entry to the login page echos a message that the error session variable is unset. Any clues? Here is the setting code and the testing code (commented out)"...
11
3352
by: doltharz | last post by:
Please Help me i'm doing something i though was to be REALLY EASY but it drives me crazy The complete code is at the end of the email (i mean newsgroup article), i always use Option Explicit and Response.Expires=-1,
2
11875
by: Gvnn | last post by:
Hi, I've few problem with Session Variables and WebServices. I've a web application (.aspx), and I assign a Session variable ( ex: Session.Add("COD",Value) ). Then I call a WebService. I need that the service read the value of the session variable, but if i try i retrive a null value. Can anyone help me? Thanks
5
1996
by: Michelle A. | last post by:
I have a four page form. Pages 1-3 stores there information in a session variables. Page four is reached (a final review page) and then the information will be written to the SQL server. When I tried to enter some code in the HTML table by hand so I could get it to show up in the right place. For example I use this code in the HTML table: <td><%=sessionvar1%><%=sessionvar2%></td>
2
2501
by: +The_Taco+ | last post by:
I already use session variable in my project to set a session timeout when the user doesn't do anything for 10 minutes. When I call other pages, I often use parameters in HREF link. I was wondering if it was better to pass parameter from page to page as session variable instead of doing it in HREF link? Thx for the hint !
1
3540
by: Vidyadhar Joshi | last post by:
I have the following scenario in a true load balanced environment (without sticky sessions): There are 2 ASPX pages. I want to pass an object from the first page to the second page. On the btnContinue_Click event of Page1.aspx, I create the object and store it in a session variable. The next statement would be Response.Redirect("Page2.aspx"). The code appears like this: private void btnContinue_Click(object sender, EventArgs e) {...
23
3652
by: lwoods | last post by:
I am trying to pass some info to another page on my site. I set "session_start()" in page 1, assign a session variable to a value, then execute a "header('Location: ....')." But on the target page I don't get any session variable values! BTW, I used a relative location in the Location header, not an absolute URL. The behavior looks like it started another session, but it should not have. Ideas? TIA,
17
5095
by: Control Freq | last post by:
Hi, Not sure if this is the right NG for this, but, is there a convention for the variable names of a Session variable? I am using .NET 2.0 in C#. I am new to all this .NET stuff, So, any guidance appreciated. Regards
0
1025
by: KDawg44 | last post by:
Hi, I have a variable I would like to put in the $_SESSION array. However, I am not accessing this through a PHP script but am instead returning this to a javascript function through an AJAX call. I need to set this as part of the session. Can I either: 1.) Set the session variable within the script that is called through the AJAX call. Will I be able to call for this on successive pages? The page is accessed only through the AJAX...
0
187
by: KDawg44 | last post by:
On Aug 2, 6:36 pm, KDawg44 <KDaw...@gmail.comwrote: Okay, when I read my own question, I think #2 doesn't even make sense since PHP is server side and js is client side. So, can #1 be done properly? Thanks.
0
9691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10279
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10036
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7582
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4150
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2948
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.