[PHP] Re: mysql question
Man-wai Chang wrote: I tried to post to mysql.general, but the message never appeared. So I am trying my luck here. How could I build an index for a table created using the CREATE TEMPORARY TABLE ... SELECT ... FROM ... syntax, using an account without the privilege to use ALTER TABLE? See the docs. CREATE INDEX syntax: http://dev.mysql.com/doc/refman/5.0/en/create-index.html About privileges: http://dev.mysql.com/doc/refman/5.0/en/grant.html You didn't send much info along, so I assume you're using some version of MySQL 5.0. HTH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Array to Object
Eli wrote: Hi, Having this array: $arr = array( 'my var'='My Value' ); Notice the space in 'my var'. Converted to object: $obj = (object)$arr; How can I access $arr['my var'] in $obj ? -thanks! print $obj-{'my var'}; $obj-{'my var'} = 'My New Value'; print $obj-{'my var'}; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: classes and objects: php5. The Basics
Cheseldine, D. L. wrote: Hi I'm stuck on The Basics page of the php5 Object Model: http://uk.php.net/manual/en/language.oop5.basic.php The top example has the code: A::foo(); even though foo is not declared static in its class. How does it get called statically without being declared static? regards dave Hi Dave, the example code seems to be damn old. It doesn't even make use of the access control modifiers. To answer your question: foo() can be called statically this way since PHP5 still supports the PHP4-way of calling static methods (backwards-compatibility). In PHP4 one can call any method statically, since there is no static modifier in PHP4. Hint: In this case PHP5 generates an error of the type E_STRICT, which tells you that one can't call a given instance method statically. error_reporting(E_ALL | E_STRICT); ini_set('display_errors', 'on'); Regards, Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Lost session variables still confounding me
Stuart Felenstein wrote: --- Jason Wong [EMAIL PROTECTED] wrote: Maybe what you had before was: if (count($myarray) 5) $_SESSION['arrayerr'] = you have selected too many industries; session_write_close(); header (Location: Page2.php?.SID); exit; And yes that has a totally different behaviour to the code with the endif; construct. Yep, that is what I had. So, no parse error, but did not work right either. Stuart So you just forgot some curly-braces then. You'd write either [code] if (count($myarray) 5) { $_SESSION['arrayerr'] = you have selected too many industries; session_write_close(); header (Location: Page2.php?.SID); exit; } [/code] or [code] if (count($myarray) 5): $_SESSION['arrayerr'] = you have selected too many industries; session_write_close(); header (Location: Page2.php?.SID); exit; endif; [/code] HTH, Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Searching My Database
Harlequin wrote: Morning everyone. I've read around the subject of searching and although using the FULLTEXT capability of MySQL might be the proper way of doing this I feel it's somewhat limited and have decided to use a simple select procedure. I'm sure there's a better way of doing this, as I'm quite new to MySQL and even newer to searches, However - here's my conundrum: I'm declaring variables at the top of my query like so: Code: $WorkPermit == ' . $_POST[WorkPermit] . '; And then execute the query like so: Code: SELECT * FROM MembersData WHERE `Work_Permit_Rqd` LIKE '$WorkPermit' But I have many other fields that the searcher can use. What do I do if they leave this field blank...? I appreciate that I should be using the MATCH function but I'm not entirely happy with the way it searches. What I need to do is actually omit a field (s) from the search if the value the searcher submitted was NULL. For example: Search field X and Y and Z and if x or Y are null continue... Am I explaining this OK...? Any suggestions gratefully received. Hello Michael! Try this script if you want (just a quick-and-dirty hack): [code] ?php if (!empty($_POST)) { $where = ''; foreach ($_POST['search'] as $field = $value) { if ('' == $value) { continue; } $where .= $field.' LIKE '.$value.' AND '; } if ('' != $where) { $where = substr($where, 0, -5); print 'SELECT * FROM Work_Permit_Rqd WHERE '.$where; } } ? form action=?php print $_SERVER['PHP_SELF']; ? method=post input type=text name=search[field1]br input type=text name=search[field2]br input type=text name=search[field3]br input type=submit name=submit value=submit /form [/code] Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to concatenate php variables in mysql query
[EMAIL PROTECTED] wrote: here is the whole query: $query = INSERT INTO inmarsat_comp SET date_added=NOW(), prefix='$prefix', firstname='$firstname', lastname='$lastname', job_title='$jobtitle', company_name='$company', no_of_employees='$employees',address_1='$address1',address_2='$address2', address_3='$address3', town='$town', county ='$county', postcode='$postcode', country ='$country', telephone_number='$telcode.$telnumber', fax_number='$faxcode.$faxnumber', email='$email', enterprise='$enterprises', optin_thirdparty='$distribute', optin_news='$market'; only the telcode gets inserted. many thanks, luke m Jay Blanchard [EMAIL PROTECTED] wrote: [snip] telphone number =$telcode.$telnumber' but only the telcode gets written to the database. [/snip] There is not enough here to know for sure (I am betting this is part of a query), but if your code looks like the above you are missing a single quote after the =. Now, if you enclose the variables in the single quotes without other manipulation it will probably not work as expected. Can we see the whole query? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hiya. Hmm... should't the query look like this: INSERT INTO table (col1, col2, ...) VALUES (val1, val2, ...); SET is used for UPDATE-queries. Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to concatenate php variables in mysql query
Daniel Kullik wrote: [EMAIL PROTECTED] wrote: here is the whole query: $query = INSERT INTO inmarsat_comp SET date_added=NOW(), prefix='$prefix', firstname='$firstname', lastname='$lastname', job_title='$jobtitle', company_name='$company', no_of_employees='$employees',address_1='$address1',address_2='$address2', address_3='$address3', town='$town', county ='$county', postcode='$postcode', country ='$country', telephone_number='$telcode.$telnumber', fax_number='$faxcode.$faxnumber', email='$email', enterprise='$enterprises', optin_thirdparty='$distribute', optin_news='$market'; only the telcode gets inserted. many thanks, luke m Jay Blanchard [EMAIL PROTECTED] wrote: [snip] telphone number =$telcode.$telnumber' but only the telcode gets written to the database. [/snip] There is not enough here to know for sure (I am betting this is part of a query), but if your code looks like the above you are missing a single quote after the =. Now, if you enclose the variables in the single quotes without other manipulation it will probably not work as expected. Can we see the whole query? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hiya. Hmm... should't the query look like this: INSERT INTO table (col1, col2, ...) VALUES (val1, val2, ...); SET is used for UPDATE-queries. Daniel Argh, sorry. I should have checked to MySQL manual before posting. The syntax you're using is also correct. But actually you don't need to concatenate strings here. Leave the dots and try it again. Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: foreach()
Anthony Ritter wrote: I get a: Warning: Invalid argument supplied for foreach() in c:\apache\htdocs\or_6.4.php on line 15 after submitting the form. Hello Anthony! As long as you don't submit the form with a single option selected there will be no $_POST['lunch'], therefore foreach() won't be able to loop through it. Add the line print_r($_POST) to your code in order to see what actually happens if you hit the submit-button of your form. Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP5] paradox ? Bug ?
Hello Frédéric. This is neither a bug nor a paradox. The code you've posted just contains some nonsense. $foo['bar'] = 'bar'; cannot work since $foo is an object and not an array. And even $foo-bar = 'bar'; cannot work because there is no property $bar. Frédéric hardy wrote: Hello - I think there is a bug or a paradox in the php 5 object model implementation. This is an example : ?php class foo implements arrayAccess { private $array = array(); function __construct() {} function __get($key) { return $this-offsetGet($key); } function __set($key, $value) { $this-offsetSet($key, $value); } function offsetExists($key) { return isset($this-array[$key]); } function offsetGet($key) { return $this-array[$key]; } function offsetSet($key, $value) { $this-array[$key] = $value; } function offsetUnset($key) { unset($this-array[$key]; } } $foo = new foo(); echo (isset($foo['bar']) == true ? 'set' : 'not set'); $foo['bar'] = 'bar'; echo (isset($foo['bar']) == true ? 'set' : 'not set'); echo $foo['bar']; #Expected result : # not set # set # bar #Real result # not set # set # bar # !! GREAT !! #Now, the same thing with __get() and __set() unset($foo); $foo = new foo(); echo (isset($foo-array) == true ? 'array is set' : 'array is not set'); echo (isset($foo-bar) == true ? 'bar is set' : 'bar is not set'); $foo-bar = 'bar'; echo (isset($foo['bar']) == true ? 'bar is set' : 'bar is not set'); echo $foo-bar; #Expected result : # array is set # bar is not set # bar is set # bar #Real result # array is set # Ok ! # bar is not set # Ok ! # bar is not set # PROBLEM PROBLEM # bar # !! NOT GREAT !! ? It is very strange. isset() does not return the good value on property wich was set with __set() !! But isset() return the good value on property wich was set in the class !! And isset() return the good value on value wich was set with offsetSet() method !! It is a paradox ! I think that isset MUST return the same value in all case. What do you think of ? Fred. Warning : the php code may be wrong (parse error...), i can not validate it in php5 currently -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [PHP5] paradox ? Bug ?
Well alright, then I ought to read the suggested sources. Thanks for the advice. Anyway, doesn't it cause trouble to have $array as a private member? Frédéric hardy wrote: Moreover, $foo['bar'] = 'bar' work perfectly... Fred. Frédéric Hardy wrote: WRONG ! Read the manual about __set() and __get(). And read http://www.php.net/~helly/php/ext/spl/index.html about arrayAccess. Php 5 allow you to overloading property dynamicaly with __set() and __get(). And you can access an object like an array with arrayAccess interface. There is no nonsense in my code. Fred. Daniel Kullik wrote: Hello Frédéric. This is neither a bug nor a paradox. The code you've posted just contains some nonsense. $foo['bar'] = 'bar'; cannot work since $foo is an object and not an array. And even $foo-bar = 'bar'; cannot work because there is no property $bar. Frédéric hardy wrote: Hello - I think there is a bug or a paradox in the php 5 object model implementation. This is an example : ?php class foo implements arrayAccess { private $array = array(); function __construct() {} function __get($key) { return $this-offsetGet($key); } function __set($key, $value) { $this-offsetSet($key, $value); } function offsetExists($key) { return isset($this-array[$key]); } function offsetGet($key) { return $this-array[$key]; } function offsetSet($key, $value) { $this-array[$key] = $value; } function offsetUnset($key) { unset($this-array[$key]; } } $foo = new foo(); echo (isset($foo['bar']) == true ? 'set' : 'not set'); $foo['bar'] = 'bar'; echo (isset($foo['bar']) == true ? 'set' : 'not set'); echo $foo['bar']; #Expected result : # not set # set # bar #Real result # not set # set # bar # !! GREAT !! #Now, the same thing with __get() and __set() unset($foo); $foo = new foo(); echo (isset($foo-array) == true ? 'array is set' : 'array is not set'); echo (isset($foo-bar) == true ? 'bar is set' : 'bar is not set'); $foo-bar = 'bar'; echo (isset($foo['bar']) == true ? 'bar is set' : 'bar is not set'); echo $foo-bar; #Expected result : # array is set # bar is not set # bar is set # bar #Real result # array is set # Ok ! # bar is not set # Ok ! # bar is not set # PROBLEM PROBLEM # bar # !! NOT GREAT !! ? It is very strange. isset() does not return the good value on property wich was set with __set() !! But isset() return the good value on property wich was set in the class !! And isset() return the good value on value wich was set with offsetSet() method !! It is a paradox ! I think that isset MUST return the same value in all case. What do you think of ? Fred. Warning : the php code may be wrong (parse error...), i can not validate it in php5 currently -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Usng Session Vaiable in WHERE Statement
Hello again, Michael! You ought to read this: http://de.php.net/manual/en/language.types.string.php#language.types.string.parsing Daniel Harlequin wrote: Could someone please help me with my syntax here...? $MembersDataQry = SELECT * FROM MembersData WHERE UserID='$_SESSION['logname']'; I get an error on line 2 but can't seem to figure out what I've missed. The variable echoes fine so I know there's a string in there. -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 'echo' and 'html_decode'
Matthew Sims wrote: I'm trying to use html_decode with the echo function but failed so far. ? echo mysql_result($product, 0,1) ? What would be the correct syntax? TIA You should read up on how to use mysql_result properly. Read through the user comments for tips. http://us2.php.net/manual/en/function.mysql-result.php For example: $query = SELECT * from tablename where index='var'; $result = mysql_result($query); while ($row = mysql_fetch_array($result)) { //do stuff with $row } --Matthew Sims --http://killermookie.org Hello. Matt, appearently you're confusing mysql_result() with mysql_query() (-: Daniel -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Mixing $_POST with text in a variable
Skippy wrote: On Mon, 19 Jul 2004 14:15:09 -0400 Jason Barnett [EMAIL PROTECTED] wrote: Markus Stobbs wrote: $message = Name: $Name Division: $Division Phone: $Phone Email: $Email; ...but when I change $Name and the other variables to $_POST['Name'], I get this error: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /web/scd/vets/Vislab/eventrequest.php on line 94 When you have a variable that is inside a text string (double quotes) like that then you do not need to have the quotes for your array index. So in your case something like this should work: $message = Name: $_POST[Name] Division: $_POST[Division] Phone: $_POST[Phone] Email: $_POST[Email]; I think this is just solving one bad practice (inserting array elements directly in strings) with another (letting undefined constants such as Name pass as variable values). The problem for Markus is that there's a limit to what kind of variables you can use directly inside strings. In particular, as he noticed, array elements referred by association ($_POST['Name']) won't work. Your workaround uses a trick: by not enclosing the element identificator (Name) in quotes, it is considered to be a constant. Since there's no constant with that name defined, it evaluates to the name of the constant, which is Name. This is bad practice; the manual page for constants specifically calls it that. And because you don't use quotes to delimitate the identificator, you don't have Markus's problem. The proper solution is to use string concatenation and thus place your variables outside of the string: $message = Name: .$_POST['Name']. Division: .$_POST['Division']. Phone: .$_POST['Phone']. Email: .$_POST['Email']; It's good habit to restrain yourself from both the above bad practices. Try to always use concatenation and specifically put variables outside of strings, and always use the quotes for array identificators. Once the habit is in you'll have less headaches to worry about. Hello. Skippy, you ought to read this: http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing.simple Explains how PHP parses variables (including arrays) inside strings. Daniel -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Parse Error, Unexpected $
Hello. Cannot find any unexpected dollar-sign ($) in this code. But please enclose the associative array-indexes within quotation-marks and run your script again. [code] $foo = $_POST['assoc_index']; [/code] Daniel Harlequin wrote: I've checked my syntax but obviously missing something. Would anyone mind a quick scan: // Convert Values to Variables: $Title = $_POST[Title]; $ChristianName = $_POST[ChristianName]; $MiddleName = $_POST[MiddleName]; $Surname = $_POST[Surname]; $HomePhone = $_POST[HomePhone]; $Address01 = $_POST[Address01]; $Address02 = $_POST[Address02]; $Address03 = $_POST[Address03]; $City = $_POST[City]; $Postcode = $_POST[Postcode]; $Country = $_POST[Country]; $Nationality = $_POST[Nationality]; $Gender = $_POST[Gender]; $WorkPermitRequired = $_POST[WorkPermitRequired]; $MyStatus = $_POST[MyStatus]; // Dump Data Into MembersData: $UserDataDump = INSERT INTO MembersData (Title, ChristianName, MiddleName, Surname, DOB, TelephoneHome, Address01, Address02, Address03, AddressCity, AddressPostcode, AddressCountry, Nationality, Gender, WorkPermit, Status) VALUES('$Title','$ChristianName','$MiddleName','$Surname','$HomePhone','$Add ress01','$Address02','$Address03','$City','$Postcode','$Country','$Nationali ty','$Gender','$WorkPermitRequired','$MyStatus'); mysql_query($UserDataDump) or die(Couldn't Create User Data Entry. MySQL Error: . mysql_error()); -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Stuffing those damn values into their fields...!
Sounds pretty harsh, but Aidan is right. Another suggestion: Set error_reporting in your php.ini to E_ALL and display_errors to On. If you don't have access to the php.ini file you can try this: [code] error_reporting(E_ALL); ini_set('display_errors', true); [/code] Paste these two lines of code into the beginning of your script. With error_reporting set to E_ALL you will also see the errors of type E_NOTICE. Daniel Aidan Lister wrote: Michael, You need to gain some very basic debugging skills. If you're trying to update a database: 1) Check the mysql_query is actually being run! Add a line above mysql_query, die('hello'); If you see hello, the query is being run 2) Check there is no error on the query, $query = some query; $result = mysql_query($query) or die('some error ' . mysql_error()); 3) Check the query echo $query; See what the query looks like, you'll quickly be able to find the mistake. Any other information you provided was useless, we don't need the entire context of your application to help you. I suggest you start learning these basic skills now and stop pasting huge volumes of crap mail to the list. Harlequin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] OK. So here we have on the submission form: input type=hidden value=$_SESSION['logname'] name=Hidden It echoes fine, so I know it's there. When I go to the target page it echoes fine there also and doesn't return an error. But more strangely, it doesn't perform the update I request: $UserDataDump = UPDATE MembersData SET Title='$Title'...) WHERE UserID='$_POST[Hidden]'; What's missing...? No error, no update...? No caffiene...! Help...! Oh - is OK, I have my Nicotine :) -- - Michael Mason Arras People www.arraspeople.co.uk - -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] track click throughs
mysql_query() should return a boolean true if your insert-query works. Check that. [code] print (mysql_query('insert bla...')) ? '(-:' : ')-:'; die(); [/code] Cab wrote: Ed, Sorry it redirects now but on checking the database is no longer being updated? ?php require_once('/home/virtual/site/var/www/cgi-bin/Connections/DB_connection _script.php'); $newUserTracking = mysql_query(INSERT INTO track (user,type) VALUES (' ','Join')); Header(Location: https://secure.ibill.com/cgi-win/ccard/rscookie.exe?RevShareID=what everreturnto=http://www.google.com/index.htm;); ? Help Col Ed Lazor [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Check the script that records the click. It shouldn't have any output, spaces, or extra lines before or after ?php ? -Original Message- From: cab [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 9:39 PM To: [EMAIL PROTECTED] Subject: [PHP] track click throughs Hi, newbie question I have a linked image, I want to track the users/times the image has been clicked. I've set up another .php page that populates a database with the click, then I wanted to: Header(Location: http://someothersite ); but I get the lovely Headers already set error message. Any suggestions please? Locations of tutorials on this sort of thing. Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Trouble with include/require
You should not overwrite the whole include-path. Just append new paths. This should do: [code] // Expand include-path (';' on Windows) $sep = ('WIN' == substr(PHP_OS, 0, 3)) ? ';' : ':'; ini_set('include_path', ini_get('include_path') . $sep . dirname(__FILE__) . 'includes/'); [/code] Daniel A. Lanza wrote: Hi list, i'm trying to include files in my php scripts but things seem not to work properly. In my script, i include a file like this: ?php include 'includes/db.inc' ? I have all include files in includes directory, that's a children of the directory where my scrips are. The include_path config. variable is set like this: include_path = .:/php/includes (i have uncommented that line) PHP does not include my files. What i am doing wrong? Thanks AL -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Trouble with include/require
Does your PHP-interpreter parse .inc files at all? Did you get any error-messages? If not, set your error-reporting level to E_ALL any force PHP to display errors on screen. [code] error_reporting(E_ALL); ini_set('display_errors', true); [/code] Place this code before your include() call. PHP should print out an error-message if it fails to include a file. A. Lanza wrote: In fact, i'm not changing the include_path in my code, just uncommented the line in php.ini configuration file. Do i have to set include_path in code? Where in code should i put that piece of code setting include_path? Is there any simple way to include files using relative paths from the ones where main scripts are? I have /var/www/html/project, where i put my scripts. includes directory is under that path. I want to put all my include files in there. I guessed that including files like this, include 'includes/db.inc', would work, since include_path is set to . in php.ini, but it does not. Any help? On Fri, 2004-07-16 at 10:35, Daniel Kullik wrote: You should not overwrite the whole include-path. Just append new paths. This should do: [code] // Expand include-path (';' on Windows) $sep = ('WIN' == substr(PHP_OS, 0, 3)) ? ';' : ':'; ini_set('include_path', ini_get('include_path') . $sep . dirname(__FILE__) . 'includes/'); [/code] Daniel A. Lanza wrote: Hi list, i'm trying to include files in my php scripts but things seem not to work properly. In my script, i include a file like this: ?php include 'includes/db.inc' ? I have all include files in includes directory, that's a children of the directory where my scrips are. The include_path config. variable is set like this: include_path = .:/php/includes (i have uncommented that line) PHP does not include my files. What i am doing wrong? Thanks AL -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Getting the primary key from a MySQL insert
Here you can find an overview of all existing MySQL functions in PHP: http://www.php.net/mysql And this is the function you are looking for: http://www.php.net/manual/en/function.mysql-insert-id.php And please take your time to look at this posting: http://marc.theaimsgroup.com/?l=php-generalm=108986762507986w=2 Daniel Andrew Wood wrote: If the primary key in a MySQL DB is an autoincrementing integer, is there anyway of automatically getting it back when I do an insert in PHP. In other words taking the status returned by mysql_query and extracting the PK of the record we just entered? -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Trouble with include/require
Using chmod 710 on your include-directroy and chmod 640 on your scripts might solve your file-permission problem. A. Lanza wrote: Still i cannot place my include files in a directory other than the same as my main scripts... I have scripts in /var/www/html/project/ directory. I would like to put the include files in /var/www/html/project/includes. How should i include them in the main scripts? I've tried the two following ways, 1. include 'includes/file.inc'; 2. ini_set('include_path', './includes'); include 'file.inc'; but neither of them have worked. Any help? On Fri, 2004-07-16 at 11:30, Daniel Kullik wrote: Does your PHP-interpreter parse .inc files at all? Did you get any error-messages? If not, set your error-reporting level to E_ALL any force PHP to display errors on screen. [code] error_reporting(E_ALL); ini_set('display_errors', true); [/code] Place this code before your include() call. PHP should print out an error-message if it fails to include a file. A. Lanza wrote: In fact, i'm not changing the include_path in my code, just uncommented the line in php.ini configuration file. Do i have to set include_path in code? Where in code should i put that piece of code setting include_path? Is there any simple way to include files using relative paths from the ones where main scripts are? I have /var/www/html/project, where i put my scripts. includes directory is under that path. I want to put all my include files in there. I guessed that including files like this, include 'includes/db.inc', would work, since include_path is set to . in php.ini, but it does not. Any help? On Fri, 2004-07-16 at 10:35, Daniel Kullik wrote: You should not overwrite the whole include-path. Just append new paths. This should do: [code] // Expand include-path (';' on Windows) $sep = ('WIN' == substr(PHP_OS, 0, 3)) ? ';' : ':'; ini_set('include_path', ini_get('include_path') . $sep . dirname(__FILE__) . 'includes/'); [/code] Daniel A. Lanza wrote: Hi list, i'm trying to include files in my php scripts but things seem not to work properly. In my script, i include a file like this: ?php include 'includes/db.inc' ? I have all include files in includes directory, that's a children of the directory where my scrips are. The include_path config. variable is set like this: include_path = .:/php/includes (i have uncommented that line) PHP does not include my files. What i am doing wrong? Thanks AL -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unset empty elements in an array
Justin French wrote: Hi, Looking for a one-liner to delete all empty elements in an array. I know I can do it with a foreach loop, but I'm hoping that I've missed an existing function in the manual which may already do this, or a simple one-liner to replace the foreach. ?php foreach($in as $k = $v) { if(empty($v)) { unset($in[$k]); } } ? --- Justin French http://indent.com.au Though it's not really a one-liner: [code] while ($key = array_search('', $in)) unset($in[$key]); [/code] For more infos on array_seach(): http://www.php.net/array_search Daniel -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unset empty elements in an array
Daniel Kullik wrote: Justin French wrote: Hi, Looking for a one-liner to delete all empty elements in an array. I know I can do it with a foreach loop, but I'm hoping that I've missed an existing function in the manual which may already do this, or a simple one-liner to replace the foreach. ?php foreach($in as $k = $v) { if(empty($v)) { unset($in[$k]); } } ? --- Justin French http://indent.com.au Though it's not really a one-liner: [code] while ($key = array_search('', $in)) unset($in[$key]); [/code] For more infos on array_seach(): http://www.php.net/array_search Daniel A note I forgot to addi in my previous posting: You ought to think over what you consider empty since empty() would for example return true if the checked variable contained the integer 0 or the string '0'. My posted line of code recognizes only an empty string as empty. You might want to take a look at this: http://www.php.net/manual/en/types.comparisons.php Daniel -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: addslashes vs string unescape
Skippy wrote: I'm confronted with a somewhat weird problem and hopefully someone can make a suggestion. I have to perform the following 3-step task: Step 1. Someone provides a string (let's call it the formatting string) which contains a PHP expression, which will apply a PHP function on another string, let's call this one the random string. I don't control either the formatting nor the random string. Example of formatting string: trim('%val%') Step 2. As you may have guessed, I have to insert the random string in the formatting string before I can eval() the latter. So I need to replace %val% with the random string. But I have to be careful, since the random string may itself contain either double or single quotes, which will break the eval() later. So I also need an addslashes(). Operations performed: $for_eval=str_replace('%val%',addslashes($random),$format); $for_eval='$final_result='.$for_eval.';'; eval($for_eval); Step 3. After the above, I should have the formatted string in $final_result. *** So now for the problem: addslashes() indiscriminately escapes with backslashes both single and double quotes. Strings variables can be specified with either single or double quotes; each of the cases, in turn, will not un-escape the other type of quote. For example, a string enclosed in double quotes will not un-escape \' and a string enclosed in single quotes will not un-escape \. But my addslashes() escaped both types of quotes. And the formatting string (see step 1) will necessarily have enclosed the string to be (%val%) in only one of the two types of quotes. So, after all steps are performed, I may very well be left with either single or double quotes still escaped, depending on the type of quotes which were used in the formatting string. I was under the impression that double quote strings will be interpreted as to unescape single quotes too. However, the manual says they don't do that; they unescape some common print sequences (such as tab or newline), double quotes (of course), backslash itself, and octal or hexa expressions. NOT single quotes. If only I could be sure of the type of quotes which were used in the formatting string, I could only escape those by hand. But I can't be sure. Also, I can't forcefully strip slashes from the final result, because I don't know which sequences that look like escapes are really escapes or are just legitimate pieces of string. If only double quote strings would un-escape both types of quotes; they don't, so their un-escape action is not a 100% reversion of the addslashes() effect. Any ideas? Can you use this? [code] ?php // Formatting string from outside - apply a function on a random value $format_string = 'trim();'; // Random value from outside - may contain quotes /-: // Leading and trailing spaces for trim() included $rand_string = eod My name is Bla, I want to do some 'foo'. eod; // Before and after - remember string's original length $strlen_start = strlen($rand_string); // Replacing all single-quotes with double-quotes $rand_string = str_replace(', '', $rand_string); // Combine format string with random string $for_eval = sprintf( '%s%s);', substr($format_string, 0, -2), addslashes($rand_string) ); // Save return value of format-random-combo in $final $for_eval = sprintf('$final = %s', $for_eval); // Dump and eval printf('tt%s/tt', $for_eval); eval($for_eval); // Before and after - remember string's new length $strlen_end = strlen($final); // Results: printf( 'brttbefore: %d, after: %d/tt', $strlen_start, $strlen_end ); ? [/code] Daniel -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Retrieving Data To Edit
Harlequin wrote: This is really confusing and I'm sure very simple to achieve. I already have values selected that I want to open and edit: $sql = SELECT * FROM RegisteredMembers WHERE UserID='$_POST[TXT_UserID]'; I basically want to recall these values on screen for the user to edit themselves. Once I've achieved that I'm assuming that I simply use an INSERT command but need to achieve the first step first of calling the data up... Did you define a constant named 'TXT_UserID'? If 'TXT_UserID' is the name of a form-element you might try this instead of your posted line of code: [code] $sql = sprintf( 'SELECT * FROM RegisteredMembers WHERE UserID = %s', $_POST['TXT_UserID'] ); [/code] (So maybe you just forgot some quotation-marks (-:) Daniel -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: MySQL Database Connection Question
Harlequin wrote: I have a user registration form that asks new users to register. However, Do I post the MySQLconnection string in the page they are completing or in the later page that the data is posted to, or both...? You ought to tell your registration-page to redirect to itself right after the visitor hit the submit-button of your form. This should to the trick: [code] form name=form action=?php print $_SERVER['PHP_SELF']; ? method=post [/code] Therefore your script will have to check if something has been posted. [code] if (!empty($_POST) isset($_POST['button_name'])) { // perform validation, insert record into database, etc } [/code] .. might do, while 'button_name' is the name of your form's submit-button. Note: You should checkout the thread 'Form Submission' started on July 6th since this is appearently not the best way to check if the user hit the submit-button. Daniel -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: MySQL Database Connection Question
Afan Pasalic wrote: July 6th? What are you talking about? Can you please give me more info about that? afan Daniel Kullik wrote: Note: You should checkout the thread 'Form Submission' started on July 6th since this is appearently not the best way to check if the user hit the submit-button. Daniel Hello Afan. On July 6th 2004 (or 2004-06-07 if you prefer ISO-dates) [EMAIL PROTECTED] started a thread named 'Form Submission'. That's all. Daniel -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: MySQL Database Connection Question
John Nichel wrote: Afan Pasalic wrote: Daniel Kullik wrote: Note: You should checkout the thread 'Form Submission' started on July 6th since this is appearently not the best way to check if the user hit the submit-button. Daniel July 6th? What are you talking about? Can you please give me more info about that? afan He's saying RTFA. http://marc.theaimsgroup.com/?l=php-generalm=108910994407822w=2 Thanks for that URL, John. Eventually CVS come to Afan's mind when he read checkout and thread. Sorry for the confusion. Daniel -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object is not instatiated on POST, Fatal error
You might as well add a reference of your db-object to global scope. [code] $GLOBALS['_db_object'] = $db; [/code] Then you could access it anywhere in your code like this: [code] $GLOBALS['_db_object']-sumbitQuery($query); [/code] Daniel Angelo Binc2 wrote: Ok guys, I have fixed the problem and its a really easy fix. basically the object was out of scope and therefore PHP treated my object name as a new variable and therefore it obvioulsy was not set because it is a new variable. SO the way I got it working was to just call the code directly and not put it in a function, or you could pass the object to the function as an argument. Hope this can help others in the future! Angelo Jason Paschal [EMAIL PROTECTED] 7/2/2004 11:22:04 AM would it be necessary/possible to make it global inside the function? - http://www.dailymedication.com - Everything you didn't know you needed until you went there and said to yourself, What did I do before I visited DailyMedication.com? and another part of you said, It does not matter. From: Angelo binc2 [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP] Object is not instatiated on POST, Fatal error Date: Fri, 02 Jul 2004 11:14:53 +0200 Hi all, I have a PHP file. and when it loads it creates an object for my database : include(db_class.inc); fine. I make a couple of calls to the database class this is also working fine. Then I post the page but to itself and then I go into a function (lets call it xfunction) which is ONLY accessed once the form has been posted and I get a fatal error: Fatal error: Call to a member function on a non-object in c:\program files\apache group\apache\htdocs\zero\opdocument.php on line 98 From what I've read my database object is not instatiated and therefore is in theory not an object. However I check before I go into the xfunction to see if the object is set and it is, then once in the function (where the error occurs) I test to see if the object is set again and it tells me that the object is not set. What could be the reason for the object not being set once being called in the function (xfunction)?? I have googled and many people get this error but not many have a clear solution. Any help or suggestions will be appreciated. Thanks Angelo Disclaimer This e-mail transmission contains confidential information, which is the property of the sender. The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Technikon or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail. For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ MSN Life Events gives you the tips and tools to handle the turning points in your life. http://lifeevents.msn.com Disclaimer This e-mail transmission contains confidential information, which is the property of the sender. The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Technikon or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail. For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911 -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem with session on first page loaded
Source: http://www.php.net/set_cookie [snip] Once the cookies have been set, they can be accessed on the next page load with the $_COOKIE or $HTTP_COOKIE_VARS arrays. [/snip] Since PHP cannot access a cookie right after it has been set PHP cannot be sure if the cookie has been accepted on client-side (user might deny cookies). Therefore PHP chooses another way of storing the current session id until next page has been loaded (GET-param, hidden-field...). Daniel Jordi Canals wrote: Hi all, I have an extrange problem with the session cookie: In all my pages there I have this two lines to start the session: session_name('jcwse'); session_start(); When I access my website, at any page, everytyhink works OK, and the session cookie is set with no problem except for links. In the fist page I aceess, all links are appended with the session ID. I mean that in every link, the ?jcwse=da22311212 ... is appended. This occurs just on the load of first page (not any else). If I reload the page, then links are formed correctly with no session ID (And sessions works perfect). This problem only arises on my ISP hosting (Linux+Apache 1.3) and does not show on my devel computer (Windows+Apache 2.0). I've been searching the manual, but found no explanation about that. Any help will be really welcome. Regards, Jordi. -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Header or includes for one-level up access?
Andre Dubuc wrote: Orginally when I designed my site, I put the db access file, conn.php, in the webarea - where all files reside. After reading a recent thread, I realize that this may not be too secure. Therefore, I would like to shove conn.php one level above the webarea. However, I don't feel like re-writng 300+ files with the new db access info, so I thought a simple re-direct page might do the trick. I've tried three methods: the header approach header(location: ../conn-up.php); an absolute header: header(location: /vhome/conn-up.php); and an include approach: include(../conn-up.php); /* Db file access (conn.php) -- all pages presently refer or call this file */ ?php session_start(); ob_start(); ? ?php /* $db = pg_connect(dbname=big user=me password=pwd); old string */ header(location: /vhome/site/conn-up.php); // tried 3 approaches above ? /* New db access (conn-up.php) - now located one level above webpages */ ?php session_start(); ob_start(); ? ?php $db = pg_connect(dbname=big user=me password=pwd); ? All three approaches will not allow db access. I'm stumped. Is it possible to do this, and will this protect the db password any better than if it stays in the webarea? Any help, guidance, or ideas most welcome. Tia, Andre Maybe this aids: [code] define('FOOBAR', realpath(dirname(__FILE__) . '/..') . '/'); require_once(FOOBAR . 'conn_up.php'); [/code] Add this line to a script in your docroot. In subdirs you'll certainly have to add some '/..'. Some prepend-file is suggested. Daniel -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: problem with embeded objects and reference
Vincent Dupont wrote: Hi, could anyone help on this 'by reference' problem. I have 2 classes. The main class as a child class. The child class has properties (array) I would like to be able to manipulate the child's properties even after the child has been inserted into the main class. Does this make sense? I can do it with by getting a reference of the child class, then setting the property,like : $tmp = $main-getChild(); //get a reference to the child object $tmp-setProperty(forth);//ok OR $main-setChildProperty(third); //ok but Whyt can't I do it directly by calling a reference to the child, like in : $child1-setproperty(second); //The property is not set or not displayed I know I need a reference to the child class that is within the maoin class, but HOW?? Here is a complete example ?php class class1{ var $child; //array function class1(){ $this-properties = array(); } //set the child object (class2) function setChild($child){ $this-child=$child; } //get the child object (class2), and call its setProperty method function setChildProperty($prop){ $theChild = $this-child; $theChild-setProperty($prop); } //return a reference to the child object function getChild(){ return $this-child; } //print the child object properties function display(){ $this-child-toString(); } } class class2{ var $properties; //array function class2(){ $this-properties = array(); } function setProperty($new_property){ $this-properties[] = $new_property; } function getProperty($index){ return $this-properties[$index]; } function toString(){ print_r($this-properties); } } $main = new class1(); $child1 = new class2(); $child1-setproperty(first);//displayed $main-setChild($child1); $child1-setproperty(second); //NOT DISPLAYED $main-setChildProperty(third); //displayed $tmp = $main-getChild(); //get a reference to the child object $tmp-setProperty(forth);//displayed $main-display(); //output : Array ( [0] = first [1] = third [2] = forth ) ? Hallo. Thogh I am not really sure if this solves your problem, but you should take a closer look at your method setChild(). Your parent-class has a property which you want to be an array. [snip] var $child; //array [/snip] But setChild() turns it into an object since the passed parameter ($child) is an object. [snip] $this-child=$child; [/snip] You should rather use something like array_push() or just $this-child[] = $child; Daniel -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session file problem?
[EMAIL PROTECTED] wrote: Code I¹m using: session_cache_expire(0); session_cache_limiter('private'); setcookie(cookie,,0,/,iffinet.com,1); session_start(); I use session_destroy(); in the logout function but the /tmp/sess_* file does not get deleted. Also the cookie doesn¹t go away even though it is set to expire at the end of the session. How can I get the /tmp/sess_* file to go away along with the cookie? This is a description of the problems I am having: 2 Problems: 1. User A's information will come up when user B logs in instead of user B's information coming up when user B logs in... User A's information seems to be cached in /tmp/sess_8ce0348cbf6704f96c2d8094e876ac3b. Any ideas how to keep this from happening? 2. When a user exits Internet Explorer without logging off and invoking session_destroy(); the user cannot log back in immediately. If I SSH into the server and delete /tmp/sess_8ce0348cbf6704f96c2d8094e876ac3b then the user can log back in. Do I need to write a shell_exec routine to delete this file when the session is destroyed? How can I tell from the server that the user has closed the window? Thanks again! /T You ought to check whether session_destroy() succeeds in removing the respective sess_* file. session_destroy() returns a boolean value. Be aware that session_destroy() won't remove any existing cookies. Also you should take a look at this notice (http://www.php.net/manual/en/function.session-cache-limiter.php): [snip] In private mode, the Expire header sent to the client may cause confusion for some browsers, including Mozilla. You can avoid this problem by using private_no_expire mode. The expire header is never sent to the client in this mode. [/snip] Daniel -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Error Reporting
Tom Chubb wrote: I ave a strange problem with my error reporting! I have set php.ini to: error_reporting = E_ALL but I don't see any errors. (After I was happy things were working on my Apache Test Server, I uploaded to my web host and discovered errors.) Thanks, Tom Make sure that display_errors in your php.ini is set to On. You might also use ini_set() to set it to On at the beginning of each of your scripts. Some prepend-file is suggested. Note (php.ini): For production web sites, you're strongly encouraged to turn this feature off, and use error logging instead (see below). Keeping display_errors enabled on a production web site may reveal security information to end users, such as file paths on your Web server, your database schema or other information. -- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: session_is_registered gets session values only after doing some output first !?
Frank Rust wrote: I try to check if a session is registered. This works fine if I first do some output echo abc; if (!session_is_registered('userid')) { do_something(); } else { redirect_to_somewhere(); } and I can't redirect to another page ... If I comment out the echo statement I get always false and $_SESSION is empty, but I could redirect somewhere... I tried php 4.3.1 and 4.3.7 with apache 2.0.45 both the same. On a Windows box the same program runs fine. Can anybody help? _ Frank Rust, Technische Universität, Institut für Theoretische Informatik Tel.: +49 531 391 9525Postfach 3329, D-38023 Braunschweig Fax.: +49 531 391 9529 Mühlenpfordtstr. 22-23, D-38106 Braunschweig You ought to make sure that the session was already started before trying to work with it. Either start the session implicitly via session.auto_start = 1 in your php.ini so a session is always started automatically or explicitly start it via session_start(). As long as the session is not started the session-array ($_SESSION, HTTP_SESSION_VARS) is not set. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php