[PHP] A Question of SESSION
Hi Daniel and gang: Considering I'm never afraid to show my ignorance, please review the following example. Because of the way I normally use sessions and considering this way works for me, I thought I knew what sessions were about -- but my faith is eroding. Cases in point 1. The following is the way I normally use sessions (with COOKIES turned ON): http://www.webbytedd.com/b/sessions It works. 2. Considering that people may have their COOKIES turned OFF, I tried this: http://www.webbytedd.com/b/sessions1/ It works when COOKIES are turned ON, but the SID does not appear in the URL -- I find that odd. However, if COOKIES are turned OFF, then SID does appear in the URL, but the process of passing session variables doesn't work -- I find that confusing. What's the point of passing the SID if it isn't going to be used? 3. Looking for an explanation, I came across Daniel's post to the PHP manual, which follows: http://www.webbytedd.com/b/sessions3 Now I am totally bonkers. What am I not getting? Cheers, tedd t...@sperling.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: A Question of SESSION
On Thu, Jun 7, 2012 at 11:15 AM, Tedd Sperling wrote: > > 3. Looking for an explanation, I came across Daniel's post to the PHP manual, > which follows: > > http://www.webbytedd.com/b/sessions3 > > Now I am totally bonkers. > > What am I not getting? Anything. Because that page 404's. ;-P Chances are, what you may be seeing as a post I made is, in fact, just someone else's user note submission which I edited. -- Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: A Question of SESSION
On Thu, Jun 7, 2012 at 11:20 AM, Daniel P. Brown wrote: > On Thu, Jun 7, 2012 at 11:15 AM, Tedd Sperling wrote: >> >> 3. Looking for an explanation, I came across Daniel's post to the PHP >> manual, which follows: >> >> http://www.webbytedd.com/b/sessions3 I see: http://www.webbytedd.com/b/sessions2/ (not 3). And yes, I edited the note, I didn't submit it. >> Now I am totally bonkers. >> >> What am I not getting? > > Anything. Because that page 404's. ;-P > > Chances are, what you may be seeing as a post I made is, in fact, > just someone else's user note submission which I edited. > > -- > > Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting > (866-) 725-4321 > http://www.parasane.net/ -- Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help with query
Hello All, I have this string defined for my query and it shows the different types of categories fine, but when I change a.categoryid = c.categoryid to a.categoryid = 1 which is only one of the categories It shows me the same record twice. $query = "select a.startdate, a.articleid, c.name, a.title, a.intro, a.datecreated from articles as a, categories as c where (a.startdate = -1 or a.startdate <= {$now}) and (a.enddate = -1 or a.enddate >= {$now}) and a.categoryid = c.categoryid order by a.startdate DESC"; while ( $row = mysql_fetch_array($res) ) { $tpldata['articles'][] = array( 'title' => $row['title'], 'intro' => makeLinks($row['intro']), 'id'=> $row['articleid'], 'categoryname' => $row['name'], 'created' => date('n/j/Y', $row['datecreated']) ); //echo $row['datecreated']; } Any Ideas??? Thanks!
[PHP] test
does it work now? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] test
It seems so Sent from my iPhone 5 Beta [Confidential use only] On 7 jun. 2012, at 20:07, Sven Kowalski wrote: > does it work now? > > -- > 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] test
On 6/7/12 1:07 PM, Sven Kowalski wrote: does it work now? It pretty much always did. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A Question of SESSION
On Thu, Jun 7, 2012 at 5:15 PM, Tedd Sperling wrote: > Hi Daniel and gang: > > Considering I'm never afraid to show my ignorance, please review the > following example. > > Because of the way I normally use sessions and considering this way works for > me, I thought I knew what sessions were about -- but my faith is eroding. > > Cases in point > > 1. The following is the way I normally use sessions (with COOKIES turned ON): > > http://www.webbytedd.com/b/sessions > > It works. > > 2. Considering that people may have their COOKIES turned OFF, I tried this: > > http://www.webbytedd.com/b/sessions1/ > > It works when COOKIES are turned ON, but the SID does not appear in the URL > -- I find that odd. > > However, if COOKIES are turned OFF, then SID does appear in the URL, but the > process of passing session variables doesn't work -- I find that confusing. > What's the point of passing the SID if it isn't going to be used? > > 3. Looking for an explanation, I came across Daniel's post to the PHP manual, > which follows: > > http://www.webbytedd.com/b/sessions3 > > Now I am totally bonkers. > > What am I not getting? > > Cheers, > > tedd Hi Tedd, I assume you're running PHP 5.3 or later, then session.use_only_cookies in php.ini is default set to 1, which means it doesn't accept PHPSESSID. Change that to 0, and it will probably work. - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with query
Jack wrote: >Hello All, > > > >I have this string defined for my query and it shows the different >types of >categories fine, but when I change a.categoryid = c.categoryid to >a.categoryid = 1 which is only one of the categories > >It shows me the same record twice. > > > >$query = "select a.startdate, a.articleid, c.name, a.title, a.intro, >a.datecreated from articles as a, categories as c where (a.startdate = >-1 or >a.startdate <= {$now}) and (a.enddate = -1 or a.enddate >= {$now}) and >a.categoryid = c.categoryid order by a.startdate DESC"; > > > > > >while ( $row = mysql_fetch_array($res) ) { > >$tpldata['articles'][] = array( > >'title' => $row['title'], > >'intro' => makeLinks($row['intro']), > >'id'=> $row['articleid'], > >'categoryname' => $row['name'], > >'created' => date('n/j/Y', >$row['datecreated']) > >); > >//echo $row['datecreated']; > >} > > > >Any Ideas??? > > > > > >Thanks! > > How many entries in total are in your categories table? You're joining the table but not putting any kind of constraint on the joined tables, so its doing a join on all the rows. You can either add an extra clause on the join, leave the original join and limit with a where clause, or use a group by on that field. Thanks, Ash http://ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with query
On 06/07/2012 09:37 AM, Jack wrote: $query = "select a.startdate, a.articleid, c.name, a.title, a.intro, a.datecreated from articles as a, categories as c where (a.startdate = -1 or a.startdate<= {$now}) and (a.enddate = -1 or a.enddate>= {$now}) and a.categoryid = c.categoryid order by a.startdate DESC"; $query = " SELECT a.startdate, a.articleid, c.name, a.title, a.intro, a.datecreated FROMarticles as a, categories as c WHERE ( a.startdate = -1 OR a.startdate <= {$now} ) AND ( a.enddate = -1 OR a.enddate >= {$now} ) -- This line must stay, it is limiting the combination of the data from -- both tables AND a.categoryid = c.categoryid -- You need to add this line to make it work, but keep the previous line AND a.categoryid = 1 ORDER BY a.startdate DESC "; -- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/ http://www.bendsource.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] help with query
Thanks Jim, worked like a charm. > -Original Message- > From: Jim Lucas [mailto:li...@cmsws.com] > Sent: Thursday, June 07, 2012 4:08 PM > To: Jack > Cc: PHP > Subject: Re: [PHP] help with query > > On 06/07/2012 09:37 AM, Jack wrote: > > $query = "select a.startdate, a.articleid, c.name, a.title, a.intro, > > a.datecreated from articles as a, categories as c where (a.startdate = > > -1 or a.startdate<= {$now}) and (a.enddate = -1 or a.enddate>= {$now}) > > and a.categoryid = c.categoryid order by a.startdate DESC"; > > $query = " > SELECT a.startdate, > a.articleid, > c.name, > a.title, > a.intro, > a.datecreated > FROMarticles as a, > categories as c > WHERE ( > a.startdate = -1 > OR > a.startdate <= {$now} > ) > AND ( > a.enddate = -1 > OR > a.enddate >= {$now} > ) > -- This line must stay, it is limiting the combination of the data from > -- both tables > AND a.categoryid = c.categoryid > -- You need to add this line to make it work, but keep the previous line > AND a.categoryid = 1 > > ORDER BY a.startdate DESC > "; > > -- > Jim Lucas > > http://www.cmsws.com/ > http://www.cmsws.com/examples/ > http://www.bendsource.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A problem about sessions
Hi all, I have a PHP script that takes very long time to execute. I manage it using the following structure: ob_start(); // some code session_start(); // some code header("Content-length: ".ob_get_length()); ob_end_flush(); // some other, very long, code! The problem I am facing is that, after having set up a session, often I have error as I don't find any simple variable that I wrote in $_SESSION. Correct my if I am wrong, but I think that $_SESSION get saved to disk only at the end of the script, after the "very long code" has been executed. There is a way to save the session manually just after ob_end_flush()? I can find a different solution, but I think it could be nice to have this working as is (if I am correct hunting this problem). Cheers, Tazio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A problem about sessions
On 8 Jun 2012, at 00:39, Tazio Ceri wrote: > I have a PHP script that takes very long time to execute. I manage it using > the following structure: > > ob_start(); > > // some code > session_start(); > // some code > > header("Content-length: ".ob_get_length()); > ob_end_flush(); > > // some other, very long, code! > > The problem I am facing is that, after having set up a session, often I have > error as > I don't find any simple variable that I wrote in $_SESSION. > Correct my if I am wrong, but I think that $_SESSION get saved to disk only > at the end of the script, after the "very long code" has been executed. > There is a way to save the session manually just after ob_end_flush()? http://php.net/session_write_close -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A problem about sessions
i can't undersans much of your question,, but i think you supposed to write the statement to set the variable's value after the "session_start()" called, like this ... session_start(); . some codes $_SESSION['some_var']; <--- don't put it before the session_start() On Thu, Jun 7, 2012 at 5:51 PM, Stuart Dallas wrote: > On 8 Jun 2012, at 00:39, Tazio Ceri wrote: > > > I have a PHP script that takes very long time to execute. I manage it > using the following structure: > > > > ob_start(); > > > > // some code > > session_start(); > > // some code > > > > header("Content-length: ".ob_get_length()); > > ob_end_flush(); > > > > // some other, very long, code! > > > > The problem I am facing is that, after having set up a session, often I > have error as > > I don't find any simple variable that I wrote in $_SESSION. > > Correct my if I am wrong, but I think that $_SESSION get saved to disk > only > > at the end of the script, after the "very long code" has been executed. > > There is a way to save the session manually just after ob_end_flush()? > > > http://php.net/session_write_close > > -Stuart > > -- > Stuart Dallas > 3ft9 Ltd > http://3ft9.com/ > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >