Re: [PHP] $GLOBALS example script on php.net

2011-03-07 Thread Ashim Kapoor
?php $globalvar1=1; $globalvar2=2; function globals() { $globals = $GLOBALS; var_dump($GLOBALS); print_r(br /Before...); print_r($globals); foreach (array( 'GLOBALS', '_ENV', 'HTTP_ENV_VARS', '_POST', 'HTTP_POST_VARS', '_GET',

[PHP] $$var

2011-03-06 Thread Ashim Kapoor
Dear All, I was reading the php manual for session_register, and I found the following line there : - $_SESSION[$var] = $$var; Why do I need $$ there ? Can someone explain? Thank you, Ashim

Re: [PHP] $$var

2011-03-06 Thread Ashim Kapoor
Hi Ashim, These are called Variable Variables. Ideally they should be avoided, as they introduce unnecessary legibility issues. This is what it does in a nutshell, it's actually quite simple: $foo = 'bar'; $bar = 'foobar'; echo $$foo;//This prints foobar What it does is, take the

Re: [PHP] $GLOBALS example script on php.net

2011-03-06 Thread Ashim Kapoor
It doesn't though, it creates a copy of the $_GLOBALS super global array, removes entries that will have been set by the system (i.e. it leaves user-defined variables) and then returns the ones that are left, so in that, the user note is perfectly correct. What has me puzzled is how unsetting

Re: [PHP] $GLOBALS example script on php.net

2011-03-06 Thread Ashim Kapoor
Unsetting doesn't leave user defined variables. Unsetting simply destroys variables (or removes elements from an array, etc). There is nothing magic or hidden in that script. I think the note meant exactly what it said: after creating a local copy of the $GLOBALS array and removing super

Re: [PHP] $GLOBALS example script on php.net

2011-03-05 Thread Ashim Kapoor
I'll remove it. How does one remove user notes from php.net ? Thank you, Ashim

Re: [PHP] $GLOBALS example script on php.net

2011-03-05 Thread Ashim Kapoor
Dear Ashley, I do follow the part when it creates a local copy of $GLOBALS. When it unsets them, is there a subtlety of unset that it ONLY unsets system defined entries? Could you please explain this ? Thank you, Ashim

[PHP] $GLOBALS example script on php.net

2011-03-04 Thread Ashim Kapoor
Dear all, I was reading this page http://php.net/manual/en/reserved.variables.globals.php and I found the following script there : Here's a function which returns an array of all user defined global variables: ?php function globals() { $globals = $GLOBALS; foreach (array(

Fwd: [PHP] Help needed with mysql import

2011-03-02 Thread Ashim Kapoor
-- Forwarded message -- From: Ashim Kapoor ashimkap...@gmail.com Date: Thu, Mar 3, 2011 at 7:22 AM Subject: Re: [PHP] Help needed with mysql import To: Jim Lucas li...@cmsws.com CREATE TABLE IF NOT EXISTS `ajax_products` ( `id` int(11) NOT NULL auto_increment, `name` varchar

[PHP] Help needed with mysql import

2011-03-01 Thread Ashim Kapoor
Dear all, I am trying to make a website with php and I found the following code in a book and I am trying to import it. The following are the beginning of the file i am trying to import with the command mysql -u root -pmypassword certainty dump I get the following error : ERROR 1067 (42000) at

[PHP] Quotes in Heredoc

2011-02-26 Thread Ashim Kapoor
Dear All, I am learning PHP by reading a book. My query pertains to the following lines : - $form_str = EOFORMSTR TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 ALIGN=CENTER WIDTH=621 TR TD ROWSPAN=2IMG WIDTH=15 HEIGHT=1 SRC=../images/spacer.gif/TD . My query is that is it true that we don't

Re: [PHP] Quotes in Heredoc

2011-02-26 Thread Ashim Kapoor
The quotes you mention are in the HTML, nothing to do with PHP. HTML will work without the quotes in most cases (unless there's a space in the value for the attribute) but the quotes are required in XHTML and will cause unexpected results. Can you elaborate on the XHTML part? Do you mean they are

Re: [PHP] Quotes in Heredoc

2011-02-26 Thread Ashim Kapoor
Yes, in HTML the quotes are optional, but they are required in XHTML documents: http://www.w3.org/TR/xhtml1/diffs.html#h-4.4 Ok Thank you, Ashim

[PHP] HTTP Authenticaion Query

2011-02-20 Thread Ashim Kapoor
?php if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm=My Realm'); header('HTTP/1.0 401 Unauthorized'); echo 'Text to send if user hits Cancel button'; exit; } else { echo pHello {$_SERVER['PHP_AUTH_USER']}./p; echo pYou entered

Fwd: [PHP] HTTP Authenticaion Query

2011-02-20 Thread Ashim Kapoor
-- Forwarded message -- From: Ashim Kapoor ashimkap...@gmail.com Date: Mon, Feb 21, 2011 at 12:46 PM Subject: Re: [PHP] HTTP Authenticaion Query To: Peter Lind peter.e.l...@gmail.com You are tired and not thinking straight. HTTP is a stateless thing: 1. you request the page

[PHP] Correct file permissions for a website

2011-02-15 Thread Ashim Kapoor
Dear All, The book PHP and MySQL bible says that the php directory should be world executable ? I remember posting a different question earlier to this list and one person suggesting this and another person replying that that was incorrect. Could someone clear the smoke on this one ? Many

[PHP] Re: using BOTH GET and POST in the same page.

2011-02-13 Thread Ashim Kapoor
OK. Thank you Jim/Nathan. Ashim : ) On Sun, Feb 13, 2011 at 1:26 AM, Nathan Rixham nrix...@gmail.com wrote: Ashim Kapoor wrote: Dear All, I am reading PHP5 and MySQL Bible. Chapter 7 of the book says that PHP can use GET and POST in the SAME page! Also it says that we can use the SAME

[PHP] using BOTH GET and POST in the same page.

2011-02-11 Thread Ashim Kapoor
Dear All, I am reading PHP5 and MySQL Bible. Chapter 7 of the book says that PHP can use GET and POST in the SAME page! Also it says that we can use the SAME variables in GET and POST variable sets and that conflict resolution is done by variable_order option in php.ini Can some one write a small

[PHP] Difference between CURLOPT_URL and wget

2011-01-22 Thread Ashim Kapoor
Dear All, I am a beginner at PHP. I was studying the curl library and I came across CURLOPT_URL.I think this can be used similar to wget ? What would be the major differences in these 2 ? Thank you, Ashim

Re: [PHP] Newbie looking for a project

2010-11-08 Thread Ashim Kapoor
if nothing else I should do that. Many thanks for your time, Ashim. On Sun, Nov 7, 2010 at 8:21 PM, tedd tedd.sperl...@gmail.com wrote: At 3:39 PM +0530 11/7/10, Ashim Kapoor wrote: Dear All, I am a beginner looking for a project to contribute. Can someone tell me some good quality projects

[PHP] Newbie looking for a project

2010-11-07 Thread Ashim Kapoor
Dear All, I am a beginner looking for a project to contribute. Can someone tell me some good quality projects where I would learn the most? I hope this is the right forum for this query. Many thanks, Ashim Kapoor