[PHP] PDO working via Apache but not at the command line?

2010-10-18 Thread Scott Baker
I have the following very simple script that uses PDO/FreeTDS to connect to a mssql server. I have PHP Version 5.3.3 running on Linux under Apache. When I view this script via apache/firefox I get proper output. If I try and run this via the command line like "php db_dump.php" I get an error c

Re: [PHP] PDO working via Apache but not at the command line?

2010-10-18 Thread Scott Baker
. Checking the output of phpinfo() I see it's calling the same php.ini (/usr/local/lib/php.ini) though. :( -- Scott Baker - Canby Telcom System Administrator - RHCE - 503.266.8253 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: [PDO] Re: [PHP] PDO working via Apache but not at the command line?

2010-10-18 Thread Scott Baker
On 10/18/2010 06:27 PM, Wez Furlong wrote: > Things to check: > > - Environment: what env vars are set or not set in your Apache vs. CLI > - Owner: are you running as the same user as your web server? > - Do you or the web server have some kind of "rc" file that might impact > how things run? Wez

[PHP] PDO Prevent duplicate field names?

2012-07-02 Thread Scott Baker
$sql = "SELECT First, Last, Age, 'Foobar' AS Last;"; This is a simplified example of a SQL query where we're returning two fields with the same name (Last). When I do a fetch_assoc with this query I only get three fields, as the second "Last" field over writes the first one. I was hoping there wa

Re: [PHP] PDO Prevent duplicate field names?

2012-07-02 Thread Scott Baker
QL was easily fixed. But it woulda been nice to have PHP realize there was a dupe when it was building that array to return to me. -- Scott Baker - Canby Telcom System Administrator - RHCE - 503.266.8253 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Overriding session length in existing session?

2011-03-03 Thread Scott Baker
I have a global header.php file that sets up a bunch of stuff: DB, global variables, and does session_start(). My header.php looks like this: #header.php $cookie_life = (86400 * 7); // Cookies last for seven days session_set_cookie_params($cookie_life,"/",".domain.com",true); session_start(); Thi

Re: [PHP] Overriding session length in existing session?

2011-03-03 Thread Scott Baker
On 03/03/2011 04:31 PM, tedd wrote: > At 2:58 PM -0800 3/3/11, Scott Baker wrote: >> I have a global header.php file that sets up a bunch of stuff: DB, >> global variables, and does session_start(). My header.php looks like >> this: >> >> #header.php >> $coo

Re: [PHP] Overriding session length in existing session?

2011-03-04 Thread Scott Baker
On 03/04/2011 05:37 AM, Marc Guay wrote: > Howdy. Don't sessions expire when the browser closes as a rule? Do > you mean the session cookie? Why not store the cookie, if one exists, > in a $_SESSION variable in your header file and then refer to that in > the rest of your code, rather than the

Re: [PHP] Overriding session length in existing session?

2011-03-07 Thread Scott Baker
On 03/04/2011 11:48 AM, Marc Guay wrote: > I think that my suggestion is still a valid solution, someone correct > me if I'm wrong. Let's say your code went like this: > > session_start(); I did a ton of digging and came up with session_regenerate_id() In my header.php I start the session as no

Re: [PHP] Overriding session length in existing session?

2011-03-07 Thread Scott Baker
On 03/04/2011 11:48 AM, Marc Guay wrote: > I think that my suggestion is still a valid solution, someone correct > me if I'm wrong. Let's say your code went like this: > > session_start(); I did a ton of digging and came up with session_regenerate_id() In my header.php I start the session as no

Re: [PHP] Overriding session length in existing session?

2011-03-08 Thread Scott Baker
On 03/08/2011 09:46 AM, Marc Guay wrote: > Hi Scott, > > I'm glad you resolved your problem. I'm curious about your method > though, as it seems to be an entirely different approach to my own. > How do you refer to your session data throughout the rest of the site? > Do you always reference the

[PHP] PHP intreprets trailing slashes incorrectly?

2011-05-19 Thread Scott Baker
I have a script: http://www.perturb.org/index.php I accidentally put a trailing / on the url and it STILL loaded: http://www.perturb.org/index.php/ Is that a bug in URL interpretation? I've tried it on three servers and all seem to have the same behavior. All three were Apache on Linux, but dif

[PHP] Create a hierarchical hash from flat source

2011-06-22 Thread Scott Baker
I have a bunch of records in a DB that look like id | parent_id -- 1 | 4 2 | 4 3 | 2 4 | 0 5 | 2 6 | 1 7 | 3 8 | 7 9 | 7 I want to build a big has that looks like: 4 -> 1 -> 6 -> 2 -> 3 -> 7 -> 9 -> 5 -> 8 I'm like 90% of the way there, but I can't get my recu

Re: [PHP] Create a hierarchical hash from flat source

2011-06-22 Thread Scott Baker
I still get the same output though. Only one level of depth :( -- Scott Baker - Canby Telcom System Administrator - RHCE - 503.266.8253 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Create a hierarchical hash from flat source

2011-06-22 Thread Scott Baker
On 06/22/2011 03:17 PM, Simon J Welsh wrote: > You still need to pass the value by reference to assign_children(), so: > $new = &$leaf[$pid]; > assign_children($pid,$list,&$new); Aha... that was it! Thanks! -- Scott Baker - Canby Telcom System Administrator - RHCE - 503.

Re: [PHP] Create a hierarchical hash from flat source

2011-06-22 Thread Scott Baker
ecated. I changed assign_children to be function assign_children($id,$list,&$leaf) Which solved that also! -- Scott Baker - Canby Telcom System Administrator - RHCE - 503.266.8253 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Get all the keys from a hierarchical hash

2011-06-23 Thread Scott Baker
I have a multi-tier hash (see below) and I'd like to be "search" the hash for a given $id, and return that section, regardless of how many layers deep it is. Sort of like how xpath works? Once I have that I'd like get ALL the children of a given node. So I could ask for 86, and get 36, 38, 56, etc

[PHP] Benchmark two functions against each other?

2011-06-27 Thread Scott Baker
I have functions that I'd like to benchmark and compare. What are the best PHP libraries or websites to do that? Something like jsperf.com but for PHP would be ideal. - Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Benchmark two functions against each other?

2011-06-27 Thread Scott Baker
viper-7.com/ http://codepad.org/ http://ideone.com/ > Just knocked this up, should do what you > want:Â https://gist.github.com/1049335 Thanks I'll check it out! -- Scott Baker - Canby Telcom System Administrator - RHCE - 503.266.8253 -- PHP General Mailing List (http://www.php.net/)