Very basic question. Help needed. Most urgent.
Hi Guys
I am pretty pretty new here. I have been suddenly assigned the job of maitaining a "functional" project originally developed in PHP/MySQL. So, I am required to first learn the language and then look for what needs to be done there.
Anyway, I am not very new to PHP style of programming, as I have knowledge of C, C++ and now C# too.
Well, when I installed PHP 4.3.9 on to my computer and successfully got phpinfo() show me the results, I then copied the project to the required location, and when tried viewing it in the browser, I get an error as follows -
Notice: Undefined index: adv_pub_user_id in C:\wwwroot\inetpub\s3\lib\css_generator.php on line 6
The line 6 of the original code is as follows -
if (!$_SESSION['adv_pub_user_id']) { $_SESSION['adv_pub_user_id'] = trim($_REQUEST['pub_id']); }
From what I understand is, unlike in ASP / ASP.NET, upon encountering a Session / Request which is unavailable/not-set-yet, no error is displayed, but in PHP it seems to be happening so. And, I guess something somewhere needs to be set to prevent this from happening.
Guys, this a very urgent and important assignment. Your help would be highly appreciated.
Thanks
Suhaib
Re: Very basic question. Help needed. Most urgent.
You are better off checking if the variabloe is set first using something like:
Code:
if (isset($_SESSION['adv_pub_user_id'])).....