Re: [PHP] strlen ?
On 7/6/2013 2:59 AM, Lester Caine wrote: Jim Giner wrote: And the answer is - yes, there is a LF char at the end of my data in my whole table. Now the question is - how the heck did I put that in there? Certainly not intentionally. The data is captured from a d/e screen I wrote and it simply grabs the post value and inserts a new record with that value along with some other values. And I don't see anything concatenating a LF to my string. The obvious question that comes to mind is 'What OS'? Having seen this sort of niggle many times I tend to find it relates to something working 'cross-os' a bit like windows ignoring case in file name and linux then complaining it can't find a file. It's probably worth checking the sting length back through your code just to confirm what added it? The best I can figure is that I did a preload of many of the names from a csv file. Apparently when I do that it stores the LF at the end of the csv line. Have to remember that the next time. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strlen ?
Jim Giner wrote: It's probably worth checking the sting length back through your code just to confirm what added it? The best I can figure is that I did a preload of many of the names from a csv file. Apparently when I do that it stores the LF at the end of the csv line. Have to remember that the next time. AH - I use that to flag the end of line when I pulled the data apart - so it gets stripped ;) Then I found fgetcsv() which replaced the manual code and gave just the data as an array. -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mongo usage
Hey all, I'm trying to pick up some basic use of MongoDB using PHP. I seem to have hit an early obstacle that I'd like your opinion on. I try to pass an array to the mongo insert function, but for some reason the function does not recognize the array I'm passing. Even though I can perform a var_dump() on the array and see the contents. Here's the output I'm seeing (with error): Mongo Test Page array(6) { ["first_name"]=> string(5) "Peter" ["last_name"]=> string(6) "Parker" ["address"]=> string(16) "175 Fifth Avenue" ["city"]=> string(8) "New York" ["state"]=> string(2) "NY" ["zip"]=> string(5) "10010" } *Notice*: Undefined variable: addresses in */var/www/mongomaven/index.php* on line *36* *Fatal error*: Call to a member function insert() on a non-object in * /var/www/mongomaven/index.php* on line *36* * * And here's the code: Mongo Test Mongo Test Page jfdb; $collection = $db->addresses; //$adresses = $connection->jfdb->adresses; $address = array( 'first_name' => 'Peter', 'last_name' => 'Parker', 'address' => '175 Fifth Avenue', 'city' => 'New York', 'state' => 'NY', 'zip' => '10010',); var_dump($address); echo ''; $addresses->insert($address); ?> I'd appreciate any advice you might have. Thanks, Tim -- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
[PHP] Guaranteed Way to Get Error Message Wanted
>It looks like you are running the thread-safe version with >FastCGI, which I understand to be counter to the recommendations. Thank you for the comment. I switched to PHP5.4.17-NTS-VC9, but the application still crashes. And still no clue as to why. So, still looking for that magic method to get PHP to report what's happening on a 500 Internal Server Error when it's (presumably? not sure...) not the server's fault. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mongo usage
Could the comma after the last element in your array be causing the problem? > Date: Sat, 6 Jul 2013 14:42:07 -0400 > From: bluethu...@gmail.com > To: php-general@lists.php.net > Subject: [PHP] mongo usage > > Hey all, > > I'm trying to pick up some basic use of MongoDB using PHP. > > I seem to have hit an early obstacle that I'd like your opinion on. I try > to pass an array to the mongo insert function, but for some reason the > function does not recognize the array I'm passing. Even though I can > perform a var_dump() on the array and see the contents. > > Here's the output I'm seeing (with error): > > Mongo Test Page array(6) { ["first_name"]=> string(5) "Peter" > ["last_name"]=> string(6) "Parker" ["address"]=> string(16) "175 Fifth > Avenue" ["city"]=> string(8) "New York" ["state"]=> string(2) "NY" > ["zip"]=> string(5) "10010" } > > *Notice*: Undefined variable: addresses in */var/www/mongomaven/index.php* on > line *36* > > *Fatal error*: Call to a member function insert() on a non-object in * > /var/www/mongomaven/index.php* on line *36* > * > * > And here's the code: > > > > Mongo Test > > > > Mongo Test Page > > > > $connection = new Mongo(); > > > $db = $connection->jfdb; > > $collection = $db->addresses; > > //$adresses = $connection->jfdb->adresses; > > $address = array( > 'first_name' => 'Peter', > 'last_name' => 'Parker', > 'address' => '175 Fifth Avenue', > 'city' => 'New York', > 'state' => 'NY', > 'zip' => '10010',); > > var_dump($address); > > echo ''; > >$addresses->insert($address); > > ?> > > > > > I'd appreciate any advice you might have. > > Thanks, > Tim > > -- > GPG me!! > > gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
Re: [PHP] mongo usage
You commented out the setting of yhe addresses variable On Jul 6, 2013 1:42 PM, "Tim Dunphy" wrote: > Hey all, > > I'm trying to pick up some basic use of MongoDB using PHP. > > I seem to have hit an early obstacle that I'd like your opinion on. I try > to pass an array to the mongo insert function, but for some reason the > function does not recognize the array I'm passing. Even though I can > perform a var_dump() on the array and see the contents. > > Here's the output I'm seeing (with error): > > Mongo Test Page array(6) { ["first_name"]=> string(5) "Peter" > ["last_name"]=> string(6) "Parker" ["address"]=> string(16) "175 Fifth > Avenue" ["city"]=> string(8) "New York" ["state"]=> string(2) "NY" > ["zip"]=> string(5) "10010" } > > *Notice*: Undefined variable: addresses in */var/www/mongomaven/index.php* > on > line *36* > > *Fatal error*: Call to a member function insert() on a non-object in * > /var/www/mongomaven/index.php* on line *36* > * > * > And here's the code: > > > > Mongo Test > > > > Mongo Test Page > > > > $connection = new Mongo(); > > > $db = $connection->jfdb; > > $collection = $db->addresses; > > //$adresses = $connection->jfdb->adresses; > > $address = array( > 'first_name' => 'Peter', > 'last_name' => 'Parker', > 'address' => '175 Fifth Avenue', > 'city' => 'New York', > 'state' => 'NY', > 'zip' => '10010',); > > var_dump($address); > > echo ''; > >$addresses->insert($address); > > ?> > > > > > I'd appreciate any advice you might have. > > Thanks, > Tim > > -- > GPG me!! > > gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B >
Re: [PHP] mongo usage
| Could the comma after the last element in your array be causing the problem? I tried removing it, but there was no change. Thanks for the suggestion! On Sat, Jul 6, 2013 at 2:55 PM, Thomas Punt wrote: > Could the comma after the last element in your array be causing the > problem? > > > Date: Sat, 6 Jul 2013 14:42:07 -0400 > > From: bluethu...@gmail.com > > To: php-general@lists.php.net > > Subject: [PHP] mongo usage > > > > > Hey all, > > > > I'm trying to pick up some basic use of MongoDB using PHP. > > > > I seem to have hit an early obstacle that I'd like your opinion on. I try > > to pass an array to the mongo insert function, but for some reason the > > function does not recognize the array I'm passing. Even though I can > > perform a var_dump() on the array and see the contents. > > > > Here's the output I'm seeing (with error): > > > > Mongo Test Page array(6) { ["first_name"]=> string(5) "Peter" > > ["last_name"]=> string(6) "Parker" ["address"]=> string(16) "175 Fifth > > Avenue" ["city"]=> string(8) "New York" ["state"]=> string(2) "NY" > > ["zip"]=> string(5) "10010" } > > > > *Notice*: Undefined variable: addresses in > */var/www/mongomaven/index.php* on > > line *36* > > > > *Fatal error*: Call to a member function insert() on a non-object in * > > /var/www/mongomaven/index.php* on line *36* > > * > > > * > > And here's the code: > > > > > > > > Mongo Test > > > > > > > > Mongo Test Page > > > > > > > > > $connection = new Mongo(); > > > > > > $db = $connection->jfdb; > > > > $collection = $db->addresses; > > > > //$adresses = $connection->jfdb->adresses; > > > > $address = array( > > 'first_name' => 'Peter', > > 'last_name' => 'Parker', > > 'address' => '175 Fifth Avenue', > > 'city' => 'New York', > > 'state' => 'NY', > > 'zip' => '10010', ); > > > > var_dump($address); > > > > echo ''; > > > > $addresses->insert($address); > > > > ?> > > > > > > > > > > I'd appreciate any advice you might have. > > > > Thanks, > > Tim > > > > -- > > GPG me!! > > > > gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B > -- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
Re: [PHP] mongo usage
| You commented out the setting of yhe addresses variable Those were both equivalent ways of stating the same thing. I tried substituting the other statement but there was no change: $db = $connection->jfdb; //$collection = $db->addresses; $adresses = $connection->jfdb->adresses; Thanks again! On Sat, Jul 6, 2013 at 2:57 PM, Jonathan Sundquist wrote: > You commented out the setting of yhe addresses variable > On Jul 6, 2013 1:42 PM, "Tim Dunphy" wrote: > >> Hey all, >> >> I'm trying to pick up some basic use of MongoDB using PHP. >> >> I seem to have hit an early obstacle that I'd like your opinion on. I try >> to pass an array to the mongo insert function, but for some reason the >> function does not recognize the array I'm passing. Even though I can >> perform a var_dump() on the array and see the contents. >> >> Here's the output I'm seeing (with error): >> >> Mongo Test Page array(6) { ["first_name"]=> string(5) "Peter" >> ["last_name"]=> string(6) "Parker" ["address"]=> string(16) "175 Fifth >> Avenue" ["city"]=> string(8) "New York" ["state"]=> string(2) "NY" >> ["zip"]=> string(5) "10010" } >> >> *Notice*: Undefined variable: addresses in >> */var/www/mongomaven/index.php* on >> line *36* >> >> *Fatal error*: Call to a member function insert() on a non-object in * >> /var/www/mongomaven/index.php* on line *36* >> * >> * >> And here's the code: >> >> >> >> Mongo Test >> >> >> >> Mongo Test Page >> > >> >> >> $connection = new Mongo(); >> >> >> $db = $connection->jfdb; >> >> $collection = $db->addresses; >> >> //$adresses = $connection->jfdb->adresses; >> >> $address = array( >> 'first_name' => 'Peter', >> 'last_name' => 'Parker', >> 'address' => '175 Fifth Avenue', >> 'city' => 'New York', >> 'state' => 'NY', >> 'zip' => '10010',); >> >> var_dump($address); >> >> echo ''; >> >>$addresses->insert($address); >> >> ?> >> >> >> >> >> I'd appreciate any advice you might have. >> >> Thanks, >> Tim >> >> -- >> GPG me!! >> >> gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B >> > -- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
Re: [PHP] Guaranteed Way to Get Error Message Wanted
On 6 July 2013 19:50, Brian Smither wrote: > >It looks like you are running the thread-safe version with > >FastCGI, which I understand to be counter to the recommendations. > > Thank you for the comment. > > I switched to PHP5.4.17-NTS-VC9, but the application still crashes. And > still no clue as to why. > > So, still looking for that magic method to get PHP to report what's > happening on a 500 Internal Server Error when it's (presumably? not > sure...) not the server's fault. Have you got all your extensions updated? Enable display_startup_errors. Try running the command line PHP ... php -r "echo 1;" With your config. Just to see if there is anything ultra obvious missing. -- Richard Quadling Twitter : @RQuadling
[PHP] Guaranteed Way to Get Error Message Wanted
>Have you got all your extensions updated? I would think so. Just to state the required disclaimers: phpinfo.php with works. Liberally peppering a tracer routine throughout the application shows it is getting executed up until one spot. But there is nothing obviously wrong with the code. Nothing! That's why I need the guaranteed message delivery on why PHP does not like the code. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Guaranteed Way to Get Error Message Wanted
On 6 July 2013 21:45, Brian Smither wrote: > >Have you got all your extensions updated? > > I would think so. Just to state the required disclaimers: > phpinfo.php with works. > Liberally peppering a tracer routine throughout the application shows it > is getting executed up until one spot. But there is nothing obviously wrong > with the code. Nothing! > > That's why I need the guaranteed message delivery on why PHP does not like > the code. > > Turn on all your error reporting/logging. Add a try/catch if appropriate. Turn off any unhandled exception processing. Load in XDebug and get a trace going, what is the code doing prior to failure? -- Richard Quadling Twitter : @RQuadling
Re: [PHP] mongo usage
On Sat, Jul 6, 2013 at 9:16 PM, Tim Dunphy wrote: > | You commented out the setting of yhe addresses variable > > Those were both equivalent ways of stating the same thing. I tried > substituting the other statement but there was no change: > > $db = $connection->jfdb; > > //$collection = $db->addresses; > > $adresses = $connection->jfdb->adresses; > > Thanks again! > > You seem to spell the variable differently (1 'd' vs. 2 'd's)? - Matijn
Re: [PHP] mongo usage
| You seem to spell the variable differently (1 'd' vs. 2 'd's)? Thanks! Fixed the type-o. Still no change. $connection = new Mongo(); $db = $connection->jfdb; //$collection = $db->addresses; $adresses = $connection->jfdb->addresses; Any other suggestions? Appreciated. Tim On Sat, Jul 6, 2013 at 5:39 PM, Matijn Woudt wrote: > > > > On Sat, Jul 6, 2013 at 9:16 PM, Tim Dunphy wrote: > >> | You commented out the setting of yhe addresses variable >> >> Those were both equivalent ways of stating the same thing. I tried >> substituting the other statement but there was no change: >> >> $db = $connection->jfdb; >> >> //$collection = $db->addresses; >> >> $adresses = $connection->jfdb->adresses; >> >> Thanks again! >> >> > You seem to spell the variable differently (1 'd' vs. 2 'd's)? > > - Matijn > -- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
[PHP] Re: mongo usage
On 06 Jul 2013 at 23:27, Tim Dunphy wrote: > | You seem to spell the variable differently (1 'd' vs. 2 'd's)? > > Thanks! Fixed the type-o. Still no change. > > $connection = new Mongo(); > >$db = $connection->jfdb; > >//$collection = $db->addresses; > >$adresses = $connection->jfdb->addresses; ~ > > Any other suggestions? Appreciated. Fix the other typo. -- Cheers -- Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mongo usage
Thanks. Sorry to bug you guys with this. That did it. sigh On Sat, Jul 6, 2013 at 6:49 PM, Tim Streater wrote: > On 06 Jul 2013 at 23:27, Tim Dunphy wrote: > > > | You seem to spell the variable differently (1 'd' vs. 2 'd's)? > > > > Thanks! Fixed the type-o. Still no change. > > > > $connection = new Mongo(); > > > >$db = $connection->jfdb; > > > >//$collection = $db->addresses; > > > >$adresses = $connection->jfdb->addresses; > > ~ > > > > > Any other suggestions? Appreciated. > > Fix the other typo. > > -- > Cheers -- Tim > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B