hello guys!!
I am new to php and currently working on some php tutorial for developing an e-commerce site. I came across a line of code:
$ME=$SCRIPT_NAME;
where $ME is a global variable. Thenafter, the script makes use of this variable many times to redirect to the same page shown in url and set values for some other variables. The problem is:
i) the above code of line shows up error
ii)when using $_SERVER['SCRIPT_NAME'] or ['PHP_SELF'] no error is displayed....but while
clicking on the link that makes use of $ME variable an error "Object Not Found" is displayed.
Currently, i am using the xampp 1.7.1 that bundles apache and php 5.3. Should i fix sth. in php.ini or sth else? help
$script_name problem
Moderator: General Moderators
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: $script_name problem
$SCRIPT_NAME would only be available if register_globals was on, which apparently its not (good thing).
Try:
Try:
Code: Select all
$ME = $_SERVER['SCRIPT_NAME'];mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: $script_name problem
Turning on register_globals didn't work.
I tried $_SERVER['SCRIPT_NAME'] too but the following error shows up in the browser:
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
I tried $_SERVER['SCRIPT_NAME'] too but the following error shows up in the browser:
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: $script_name problem
You need to do some debugging by printing some vars and different places. echo $ME; what is it? Is that a valid page? etc...
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: $script_name problem
Thank you for your suggestion.....I tried that and $ME=$_SERVER['SCRIPT_NAME'] is working fine.....
Can you give some other suggestion or a bit more explanation to your last suggestion:
Can you give some other suggestion or a bit more explanation to your last suggestion:
I don't quite catch by what u said ".......'different places'..............".You need to do some debugging by printing some vars and different places. echo $ME; what is it? Is that a valid page? etc...
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: $script_name problem
Well, anywhere you use $ME, do an echo $ME; Is that a valid URL and does that page exist? That's what I meant, but you say it is working.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: $script_name problem
Tried all bits and bytes but still can't find a way to solve the problem.....seems to me that the server is messed up (but am not sure). And of course thanks Shawn for your cooperation....and, will follow up your suggested link....