Re: [PHP] session lost problem
bug zhu hat am 24. April 2012 um 08:28 geschrieben: > thank you for your explanation, > when i write to $_SESSION after session_commit(),$_SESSION is just a > regular array Yes. Actually session_commit does not "terminate" the session as mentioned earlier but is closes it for writing. You cann still read session values. The benefit of using session_commit is that the server saved associated session file is no longer locked, so that parallel requests can both access the values. The approach ist as follows: Call session_commit() as early in you code (after session_open) as possible to avoid locking. So first do all the writing to the $_SESSION array, then do write close (or commit). After that you can still read all session relevant information. If you want to write afterwards to your $_SESSIOn array you simply have to call session_start to re-open the write context. Afterwards you can commit it again to remove the lock. But be careful! session_start and session_commit perform write operations on your harddisk or whatever storage you use. Many calls to start and commit will result in losing performance. Regards, Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session lost problem
2012/4/24 ma...@behnke.biz > > > bug zhu hat am 24. April 2012 um 08:28 geschrieben: > > > thank you for your explanation, > > when i write to $_SESSION after session_commit(),$_SESSION is just a > > regular array > > Yes. Actually session_commit does not "terminate" the session as mentioned > earlier but is closes it for writing. You cann still read session values. > > The benefit of using session_commit is that the server saved associated > session file is no longer locked, so that parallel requests can both access > the values. > > The approach ist as follows: > Call session_commit() as early in you code (after session_open) as possible > to avoid locking. So first do all the writing to the $_SESSION array, then > do write close (or commit). After that you can still read all session > relevant information. > > If you want to write afterwards to your $_SESSIOn array you simply have to > call session_start to re-open the write context. Afterwards you can commit > it again to remove the lock. > > But be careful! session_start and session_commit perform write operations > on your harddisk or whatever storage you use. Many calls to start and > commit will result in losing performance. > > Regards, > Marco > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > got it, very appreciate you explanation:-) -- thanks, bugzhu
Re: [PHP] Re: No error reporting on
Sounds like a very good reason to me? It's a development tool. Add it now, remove it later. "Dotan Cohen" wrote in message news:cakdxfkn+6mn9chuqdwevx5ap0km-rkls0q+carbf5hktvuo...@mail.gmail.com... On Mon, Apr 23, 2012 at 16:53, Jim Lucas wrote: >> Possibly, thanks. I actually don't have access to that! >> > > That line should be placed in your script. not the php.ini file > Yes, I'm working on a functions file that is include()ed by the main script. I'm not supposed to touch the main script without a very good reason. -- Dotan Cohen http://gibberish.co.il http://what-is-what.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Hmm.. this is strange..
Hello. I have a upload form in a html file and a corresponding PHP file that shall take care of the information. But I am doing something newbie error here.. What am I doing wrong? (The text is norwegian, but you still see and understand the PHP code) bildegalleri.html - Opplasting til Fotogalleri Opplasting til Fotogalleri Velg bilde for opplasting Filbane bildegalleri.php - Bildegalleri Bildegalleri When I run this script, I always get "Ok". Even when the input file field is empty.. Can someone tell me what I am doing wroing in this? Thanks for you time and effort to help me out. Karl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hmm.. this is strange..
Hi, Instead of just checking if the variable is not set, additionally check if it is empty Kind regards/met vriendelijke groet, Serge Fonville http://www.sergefonville.nl Convince Google!! They need to add GAL support on Android (star to agree) http://code.google.com/p/android/issues/detail?id=4602 2012/4/24 Karl-Arne Gjersøyen : > Hello. > I have a upload form in a html file and a corresponding PHP file that > shall take care of the information. > But I am doing something newbie error here.. > > What am I doing wrong? (The text is norwegian, but you still see and > understand the PHP code) > > bildegalleri.html > - > > > > > Opplasting til Fotogalleri > > > > Opplasting til Fotogalleri > > > Velg bilde for opplasting > Filbane > > > > > > > > bildegalleri.php > - > if(!isset($_POST['last_opp_fil'])){ > header('Location: bildegalleri.html'); > } > elseif(empty($_FILES['filbane'])){ > header('Location: bildegalleri.html'); > } else { > ?> > > > > > Bildegalleri > > > Bildegalleri > echo "OK"; > } > ?> > > > > When I run this script, I always get "Ok". Even when the input file > field is empty.. Can someone tell me what I am doing wroing in this? > > Thanks for you time and effort to help me out. > > Karl > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hmm.. this is strange..
Here I try to check if the input file is empty or not. But still it did not work. I receive OK even when the input file field is empty.. Bildegalleri Bildegalleri Den 16:48 24. april 2012 skrev Serge Fonville følgende: > Hi, > > Instead of just checking if the variable is not set, additionally > check if it is empty > > Kind regards/met vriendelijke groet, > > Serge Fonville > > http://www.sergefonville.nl > > Convince Google!! > They need to add GAL support on Android (star to agree) > http://code.google.com/p/android/issues/detail?id=4602 > > > 2012/4/24 Karl-Arne Gjersøyen : >> Hello. >> I have a upload form in a html file and a corresponding PHP file that >> shall take care of the information. >> But I am doing something newbie error here.. >> >> What am I doing wrong? (The text is norwegian, but you still see and >> understand the PHP code) >> >> bildegalleri.html >> - >> >> >> >> >> Opplasting til Fotogalleri >> >> >> >> Opplasting til Fotogalleri >> >> >> Velg bilde for opplasting >> Filbane >> >> >> >> >> >> >> >> bildegalleri.php >> - >> > if(!isset($_POST['last_opp_fil'])){ >> header('Location: bildegalleri.html'); >> } >> elseif(empty($_FILES['filbane'])){ >> header('Location: bildegalleri.html'); >> } else { >> ?> >> >> >> >> >> Bildegalleri >> >> >> Bildegalleri >> > echo "OK"; >> } >> ?> >> >> >> >> When I run this script, I always get "Ok". Even when the input file >> field is empty.. Can someone tell me what I am doing wroing in this? >> >> Thanks for you time and effort to help me out. >> >> Karl >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hmm.. this is strange..
Thank you very much Tolga! if(empty($_FILES['filbane']['name'])) 24.04.2012 17:54 tarihinde, Karl-Arne Gjersøyen yazdı: > Here I try to check if the input file is empty or not. But still it > did not work. I receive OK even when the input file field is empty.. > > if(!isset($_POST['last_opp_fil'])){ > header('Location: bildegalleri.html'); > } else { > $bildefil = $_FILES['filbane']; > if(empty($bildefil)){ > header('Location: bildegalleri.html'); > } else { > ?> > > > > > Bildegalleri > > > Bildegalleri > echo "OK"; > } > } > ?> > > > > Den 16:48 24. april 2012 skrev Serge Fonville > følgende: >> >> Hi, >> >> Instead of just checking if the variable is not set, additionally >> check if it is empty >> >> Kind regards/met vriendelijke groet, >> >> Serge Fonville >> >> http://www.sergefonville.nl >> >> Convince Google!! >> They need to add GAL support on Android (star to agree) >> http://code.google.com/p/android/issues/detail?id=4602 >> >> >> 2012/4/24 Karl-Arne Gjersøyen: >>> >>> Hello. >>> I have a upload form in a html file and a corresponding PHP file that >>> shall take care of the information. >>> But I am doing something newbie error here.. >>> >>> What am I doing wrong? (The text is norwegian, but you still see and >>> understand the PHP code) >>> >>> bildegalleri.html >>> - >>> >>> >>> >>> >>> Opplasting til Fotogalleri >>> >>> >>> >>> Opplasting til Fotogalleri >>> >>> >>> Velg bilde for opplasting >>> Filbane >>> >>> >>> >>> >>> >>> >>> >>> bildegalleri.php >>> - >>> >> if(!isset($_POST['last_opp_fil'])){ >>> header('Location: bildegalleri.html'); >>> } >>> elseif(empty($_FILES['filbane'])){ >>> header('Location: bildegalleri.html'); >>> } else { >>> ?> >>> >>> >>> >>> >>> Bildegalleri >>> >>> >>> Bildegalleri >>> >> echo "OK"; >>> } >>> ?> >>> >>> >>> >>> When I run this script, I always get "Ok". Even when the input file >>> field is empty.. Can someone tell me what I am doing wroing in this? >>> >>> Thanks for you time and effort to help me out. >>> >>> Karl >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> -- Hjemmeside: http://www.karl-arne.name/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] NULL Problem
Here's my code (using MSSQL): $conn = new COM ("ADODB.Connection")or die("Cannot start ADO"); $conn->open($connStr); $query = "SELECT * FROM TABLE WHERE id = ".$id; $rs = $conn->execute($query); This code works fine, and I retrieve the values like this: $tmp1 = $rs->fields("column1"); $tmp2 = $rs->fields("column2"); Etc... Here's the problem - I'm trying to get a date column that I know is NULL, but I can't seem to get my code right: $tmp = $rs->fields("followup_on"); if(is_null($tmp)){ $followup = ""; }else{ $followup = $rs->fields("followup_on"); } //this results in: Catchable fatal error: Object of class variant could not be converted to string //When I try to ECHO the $followup results (and I know the database value is NULL) So confused - any advice? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] NULL Problem
On Tue, Apr 24, 2012 at 7:29 PM, David Stoltz wrote: > Here's my code (using MSSQL): > > $conn = new COM ("ADODB.Connection")or die("Cannot start ADO"); > $conn->open($connStr); > $query = "SELECT * FROM TABLE WHERE id = ".$id; > $rs = $conn->execute($query); > > This code works fine, and I retrieve the values like this: > > $tmp1 = $rs->fields("column1"); > $tmp2 = $rs->fields("column2"); > Etc... > > > Here's the problem - I'm trying to get a date column that I know is > NULL, but I can't seem to get my code right: > > $tmp = $rs->fields("followup_on"); > if(is_null($tmp)){ > $followup = ""; > }else{ > $followup = $rs->fields("followup_on"); > } > > //this results in: Catchable fatal error: Object of class variant could > not be converted to string > //When I try to ECHO the $followup results (and I know the database > value is NULL) > > > So confused - any advice? > It's been a long time ago I worked with ADO (Thank god), but shouldn't you echo $followup->value instead of $followup? If that's not working, try a var_dump($followup), so you can check exactly what it is. - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] NULL Problem
Have you considered the PHP MSSQL driver? http://www.microsoft.com/download/en/details.aspx?id=20098 Kind regards/met vriendelijke groet, Serge Fonville http://www.sergefonville.nl Convince Google!! They need to add GAL support on Android (star to agree) http://code.google.com/p/android/issues/detail?id=4602 2012/4/24 Matijn Woudt : > On Tue, Apr 24, 2012 at 7:29 PM, David Stoltz wrote: >> Here's my code (using MSSQL): >> >> $conn = new COM ("ADODB.Connection")or die("Cannot start ADO"); >> $conn->open($connStr); >> $query = "SELECT * FROM TABLE WHERE id = ".$id; >> $rs = $conn->execute($query); >> >> This code works fine, and I retrieve the values like this: >> >> $tmp1 = $rs->fields("column1"); >> $tmp2 = $rs->fields("column2"); >> Etc... >> >> >> Here's the problem - I'm trying to get a date column that I know is >> NULL, but I can't seem to get my code right: >> >> $tmp = $rs->fields("followup_on"); >> if(is_null($tmp)){ >> $followup = ""; >> }else{ >> $followup = $rs->fields("followup_on"); >> } >> >> //this results in: Catchable fatal error: Object of class variant could >> not be converted to string >> //When I try to ECHO the $followup results (and I know the database >> value is NULL) >> >> >> So confused - any advice? >> > > It's been a long time ago I worked with ADO (Thank god), but shouldn't > you echo $followup->value instead of $followup? > If that's not working, try a var_dump($followup), so you can check > exactly what it is. > > - Matijn > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] NULL Problem
Matijn - it worked! Geez... Strange - I don't need the ->value if it actually has a value, only if it's NULL... But it works! Thanks! -Original Message- From: Matijn Woudt [mailto:tijn...@gmail.com] Sent: Tuesday, April 24, 2012 1:40 PM To: David Stoltz Cc: php-general@lists.php.net Subject: Re: [PHP] NULL Problem On Tue, Apr 24, 2012 at 7:29 PM, David Stoltz wrote: > Here's my code (using MSSQL): > > $conn = new COM ("ADODB.Connection")or die("Cannot start ADO"); > $conn->open($connStr); > $query = "SELECT * FROM TABLE WHERE id = ".$id; > $rs = $conn->execute($query); > > This code works fine, and I retrieve the values like this: > > $tmp1 = $rs->fields("column1"); > $tmp2 = $rs->fields("column2"); > Etc... > > > Here's the problem - I'm trying to get a date column that I know is > NULL, but I can't seem to get my code right: > > $tmp = $rs->fields("followup_on"); > if(is_null($tmp)){ > $followup = ""; > }else{ > $followup = $rs->fields("followup_on"); > } > > //this results in: Catchable fatal error: Object of class variant could > not be converted to string > //When I try to ECHO the $followup results (and I know the database > value is NULL) > > > So confused - any advice? > It's been a long time ago I worked with ADO (Thank god), but shouldn't you echo $followup->value instead of $followup? If that's not working, try a var_dump($followup), so you can check exactly what it is. - Matijn
RE: [PHP] NULL Problem
Serge, We don't use MSSQL for much, mostly use MySQL... But I don't want to switch out all the drivers for this one issue, which is now resolved (thanks Matijn) -Original Message- From: Serge Fonville [mailto:serge.fonvi...@gmail.com] Sent: Tuesday, April 24, 2012 1:45 PM To: Matijn Woudt Cc: David Stoltz; php-general@lists.php.net Subject: Re: [PHP] NULL Problem Have you considered the PHP MSSQL driver? http://www.microsoft.com/download/en/details.aspx?id=20098 Kind regards/met vriendelijke groet, Serge Fonville http://www.sergefonville.nl Convince Google!! They need to add GAL support on Android (star to agree) http://code.google.com/p/android/issues/detail?id=4602 2012/4/24 Matijn Woudt : > On Tue, Apr 24, 2012 at 7:29 PM, David Stoltz wrote: >> Here's my code (using MSSQL): >> >> $conn = new COM ("ADODB.Connection")or die("Cannot start ADO"); >> $conn->open($connStr); >> $query = "SELECT * FROM TABLE WHERE id = ".$id; >> $rs = $conn->execute($query); >> >> This code works fine, and I retrieve the values like this: >> >> $tmp1 = $rs->fields("column1"); >> $tmp2 = $rs->fields("column2"); >> Etc... >> >> >> Here's the problem - I'm trying to get a date column that I know is >> NULL, but I can't seem to get my code right: >> >> $tmp = $rs->fields("followup_on"); >> if(is_null($tmp)){ >> $followup = ""; >> }else{ >> $followup = $rs->fields("followup_on"); >> } >> >> //this results in: Catchable fatal error: Object of class variant could >> not be converted to string >> //When I try to ECHO the $followup results (and I know the database >> value is NULL) >> >> >> So confused - any advice? >> > > It's been a long time ago I worked with ADO (Thank god), but shouldn't > you echo $followup->value instead of $followup? > If that's not working, try a var_dump($followup), so you can check > exactly what it is. > > - Matijn > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What is wrong here?
Hello again. I can't figure out what is wrong here. move_uploaded_file() get error message from die() and can't copy/move temp_file into directory bilder I have try to chmod 0777 bilder/ but it did not help. Also I have try to chown www-data.www-data bilder/ since Ubuntu Server run apache as www-data user... Here is my souce code -- // Temfil lagres midlertidig på serveren som // spesifisert i php.ini $tmp_fil = $_FILES['filbane']['temp_name']; // lagre filnavnet.. $filnavn = "bilder/" . $_FILES['filbane']['name']; // ..og legg fila i katalogen bilder move_uploaded_file($tmp_fil, $filnavn) or die("Feilmelding: Kunne ikke flytte $filnavn"); Karl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php