Re: [PHP] PDO Transaction

2013-03-16 Thread Lester Caine
Simon Dániel wrote: 2013/3/15 Lester Caine Simon Dániel wrote: Hi, I have a trouble with PDO transactions. I would like to start using transactions, but I am not familiar with it. I have got a 'There is no active transaction' exception, however, I am using beginTransaction method, and also

Re: [PHP] PDO Transaction

2013-03-16 Thread Simon Dániel
2013/3/15 Lester Caine > Simon Dániel wrote: > >> Hi, >> >> I have a trouble with PDO transactions. >> >> I would like to start using transactions, but I am not familiar with it. I >> have got a 'There is no active transaction' exception, however, I am using >> beginTransaction method, and also I

Re: [PHP] PDO Transaction

2013-03-15 Thread Lester Caine
Simon Dániel wrote: Hi, I have a trouble with PDO transactions. I would like to start using transactions, but I am not familiar with it. I have got a 'There is no active transaction' exception, however, I am using beginTransaction method, and also I have set PDO::ATTR_AUTOCOMMIT to false right

[PHP] PDO Transaction

2013-03-15 Thread Simon Dániel
Hi, I have a trouble with PDO transactions. I would like to start using transactions, but I am not familiar with it. I have got a 'There is no active transaction' exception, however, I am using beginTransaction method, and also I have set PDO::ATTR_AUTOCOMMIT to false right after connecting to th

RE: [PHP] PDO question

2012-11-29 Thread admin
> -Original Message- > From: Jim Lucas [mailto:li...@cmsws.com] > Sent: Wednesday, November 28, 2012 9:23 PM > To: ad...@buskirkgraphics.com > Cc: php-general@lists.php.net > Subject: Re: [PHP] PDO question > > On 11/28/2012 12:58 PM, ad...@buskirkgraphics.com wr

Re: [PHP] PDO question

2012-11-28 Thread Fatih P.
On Wed, Nov 28, 2012 at 9:22 PM, Jim Lucas wrote: > On 11/28/2012 12:58 PM, ad...@buskirkgraphics.com wrote: > >> >> Guys, >> I am not quiet sure what is happening but every time i try to connect to a >> remote host it refers back to localhost. >> >> $pdo = new PDO('mysql:host=171.16.23.44;**dbna

Re: [PHP] PDO question

2012-11-28 Thread Jim Lucas
On 11/28/2012 12:58 PM, ad...@buskirkgraphics.com wrote: Guys, I am not quiet sure what is happening but every time i try to connect to a remote host it refers back to localhost. $pdo = new PDO('mysql:host=171.16.23.44;dbname=test', 'user','password'); ERROR: Access denied for user 'user'@'loc

Re: [PHP] PDO mysql Connection issue

2012-11-28 Thread Admin
> On Wednesday, November 28, 2012 at 4:50 PM, ad...@buskirkgraphics.com wrote: >> I am having a PDO mysql connection issue I cant explain. >> >> On server server1.mydomain.com (http://server1.mydomain.com) >> I have a test script >> > $pdo = new PDO('mysql:host=171.16.23.44;dbname=test', 'user','

Re: [PHP] PDO mysql Connection issue

2012-11-28 Thread Mike Mackintosh
On Wednesday, November 28, 2012 at 4:50 PM, ad...@buskirkgraphics.com wrote: > I am having a PDO mysql connection issue I cant explain. > > On server server1.mydomain.com (http://server1.mydomain.com) > I have a test script > $pdo = new PDO('mysql:host=171.16.23.44;dbname=test', 'user','password'

[PHP] PDO mysql Connection issue

2012-11-28 Thread ad...@buskirkgraphics.com
I am having a PDO mysql connection issue I cant explain. On server server1.mydomain.com I have a test script 171.16.23.44 is by an A record called server2.mydoamin.com they are 2 different servers. This script returns an error: ERROR: Access denied for user 'user'@'server1.mydomain.com' (using p

[PHP] PDO question

2012-11-28 Thread ad...@buskirkgraphics.com
Guys, I am not quiet sure what is happening but every time i try to connect to a remote host it refers back to localhost. $pdo = new PDO('mysql:host=171.16.23.44;dbname=test', 'user','password'); ERROR: Access denied for user 'user'@'localhost' (using password: YES) in /var/www/html/text.php An

Re: [PHP] PDO

2012-10-22 Thread Lester Caine
Silvio Siefke wrote: i found the mistake, i have forgetten write the new path for the sqlite database. Just been caught with a similar problem. Had moved a working site from windows to linux and it stopped serving up the swf files. Turns out the file has a hardcoded path with upper and lower

Re: [PHP] PDO

2012-10-22 Thread Silvio Siefke
Hello, i found the mistake, i have forgetten write the new path for the sqlite database. Thx Silvio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] PDO

2012-10-22 Thread Adam Richardson
On Mon, Oct 22, 2012 at 5:27 PM, Silvio Siefke wrote: > Hello, > > i have built php 5.4.7 on Ubuntu with the configure Arguments like on my > Gentoo System. But on Gentoo run the website without Problems, under Ubuntu > want not work. I become in error.log: > > [22-Oct-2012 21:15:00 UTC] PHP Fatal

Re: [PHP] PDO

2012-10-22 Thread Ashley Sheridan
On Mon, 2012-10-22 at 23:27 +0200, Silvio Siefke wrote: > Hello, > > i have built php 5.4.7 on Ubuntu with the configure Arguments like on my > Gentoo System. But on Gentoo run the website without Problems, under Ubuntu > want not work. I become in error.log: > > [22-Oct-2012 21:15:00 UTC] PHP

Re: [PHP] PDO

2012-10-22 Thread Nathan Nobbe
On Mon, Oct 22, 2012 at 3:27 PM, Silvio Siefke wrote: > Hello, > > i have built php 5.4.7 on Ubuntu with the configure Arguments like on my > Gentoo System. But on Gentoo run the website without Problems, under Ubuntu > want not work. I become in error.log: > > [22-Oct-2012 21:15:00 UTC] PHP Fata

[PHP] PDO

2012-10-22 Thread Silvio Siefke
Hello, i have built php 5.4.7 on Ubuntu with the configure Arguments like on my Gentoo System. But on Gentoo run the website without Problems, under Ubuntu want not work. I become in error.log: [22-Oct-2012 21:15:00 UTC] PHP Fatal error: Call to a member function prepare() on a non-object in h

Re: [PHP] PDO: extend or encapsulate?

2012-07-15 Thread tamouse mailing lists
On Sun, Jul 15, 2012 at 5:50 AM, shiplu wrote: > From OOP point of view. > > Use encapsulation: > When a class has a "has-a" relation-ship with other class you should use > encapsulation. For example, If MyDB is a class that "has-a" pdo driver in > it, then PDO will be encapsulated inside MyDB cla

Re: [PHP] PDO: extend or encapsulate?

2012-07-15 Thread shiplu
>From OOP point of view. Use encapsulation: When a class has a "has-a" relation-ship with other class you should use encapsulation. For example, If MyDB is a class that "has-a" pdo driver in it, then PDO will be encapsulated inside MyDB class. This is also called containment. MyDB should contain P

Re: [PHP] PDO: extend or encapsulate?

2012-07-14 Thread Marco Behnke
Am 14.07.12 10:09, schrieb Tony Marston: > wrote in message > news:1535031289.371987.1342162338279.javamail.open-xcha...@email.1und1.de... >> >> >> >> >> tamouse mailing lists hat am 13. Juli 2012 >> um 07:06 >> geschrieben: >> >>> It's Friday, so... >>> >>> Yes, it's true, I have just started loo

Re: [PHP] PDO: extend or encapsulate?

2012-07-14 Thread Lester Caine
tamouse mailing lists wrote: I am rather agreeing with both of you. Back in the days I used to poke at Java, one of the caveats was to only inherit from abstract classes, and encapsulate final classes. It does make more sense to me that way. One option is to keep both drivers available ... ADOd

Re: [PHP] PDO: extend or encapsulate?

2012-07-14 Thread Tony Marston
wrote in message news:1535031289.371987.1342162338279.javamail.open-xcha...@email.1und1.de... tamouse mailing lists hat am 13. Juli 2012 um 07:06 geschrieben: It's Friday, so... Yes, it's true, I have just started looking at using PDO instead of mysqli -- a bit behind the times... My q

Re: [PHP] PDO: extend or encapsulate?

2012-07-14 Thread tamouse mailing lists
On Sat, Jul 14, 2012 at 12:04 AM, Paul M Foster wrote: > On Fri, Jul 13, 2012 at 12:06:22AM -0500, tamouse mailing lists wrote: > >> It's Friday, so... >> >> Yes, it's true, I have just started looking at using PDO instead of >> mysqli -- a bit behind the times... >> >> My question at this stage,

Re: [PHP] PDO: extend or encapsulate?

2012-07-13 Thread Paul M Foster
On Fri, Jul 13, 2012 at 12:06:22AM -0500, tamouse mailing lists wrote: > It's Friday, so... > > Yes, it's true, I have just started looking at using PDO instead of > mysqli -- a bit behind the times... > > My question at this stage, is do people tend to extend the PDO class > for their own use,

Re: [PHP] PDO: extend or encapsulate?

2012-07-12 Thread ma...@behnke.biz
tamouse mailing lists hat am 13. Juli 2012 um 07:06 geschrieben: > It's Friday, so... > > Yes, it's true, I have just started looking at using PDO instead of > mysqli -- a bit behind the times... > > My question at this stage, is do people tend to extend the PDO class > for their own use, or e

[PHP] PDO: extend or encapsulate?

2012-07-12 Thread tamouse mailing lists
It's Friday, so... Yes, it's true, I have just started looking at using PDO instead of mysqli -- a bit behind the times... My question at this stage, is do people tend to extend the PDO class for their own use, or encapsulate it in a class (or do most people use it mostly in procedural code?) --

Re: [PHP] PDO Prevent duplicate field names?

2012-07-03 Thread tamouse mailing lists
On Mon, Jul 2, 2012 at 5:38 PM, Scott Baker wrote: > It was my mistake, and the SQL 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. This is just not a province of PHP. What sort of behaviour would one expect PHP t

Re: [PHP] PDO Prevent duplicate field names?

2012-07-02 Thread Jim Lucas
On 07/02/2012 03:38 PM, Scott Baker wrote: On 07/02/2012 03:34 PM, Matijn Woudt wrote: Why the would you want to return 2 columns with the same name? To be short, there's no such function, so you have to: 1) Rename one of the columns 2) or, use fetch_row with numerical indexes instead of fe

Re: [PHP] PDO Prevent duplicate field names?

2012-07-02 Thread Matijn Woudt
On Tue, Jul 3, 2012 at 12:38 AM, Scott Baker wrote: > On 07/02/2012 03:34 PM, Matijn Woudt wrote: >> Why the would you want to return 2 columns with the same name? >> To be short, there's no such function, so you have to: >> 1) Rename one of the columns >> 2) or, use fetch_row with numerical

Re: [PHP] PDO Prevent duplicate field names?

2012-07-02 Thread Scott Baker
On 07/02/2012 03:34 PM, Matijn Woudt wrote: > Why the would you want to return 2 columns with the same name? > To be short, there's no such function, so you have to: > 1) Rename one of the columns > 2) or, use fetch_row with numerical indexes instead of fetch_assoc. My "real world" scenario w

Re: [PHP] PDO Prevent duplicate field names?

2012-07-02 Thread Matijn Woudt
On Tue, Jul 3, 2012 at 12:25 AM, Scott Baker wrote: > $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

[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

[PHP] PHP, PDO and MS-SQL ?

2011-12-09 Thread Andreas
Hi, could someone tell me what I need to install and how to configure everything so that I can connect with PHP and PDO to a MS-SQL server? I have an OpenSuse 11.4 installation. I added the Apache-PHP repository and upgraded to PHP 5.3.8. php-mssql, -php-odbc, libfreetds and the freetds-tools

Re: [PHP] PDO Prepared Statements and stripslashes

2010-12-21 Thread Rico Secada
On Tue, 21 Dec 2010 10:32:21 -0500 Adam Richardson wrote: > 1. Turn off magic_quotes_gpc if on, as its use has been deprecated. > 2. Use prepared statements. > 3. Don't worry about stripping slashes ever again :) Thank you for a very enlightening answer. I guess I misunderstood the "PDO automati

Re: [PHP] PDO Prepared Statements and stripslashes

2010-12-21 Thread Adam Richardson
d be done in such a way that it doesn't matter how you handle the data afterwards (your code shouldn't have to keep track of whether it has to call stripslashes(), with one notable problem being that calling stripslashes() twice on the same data can lead to a value that differs from the ori

Re: [PHP] PDO Prepared Statements and stripslashes

2010-12-20 Thread Ravi Gehlot
lett he mentions the > > > following in a comment: "The process of escaping should preserve > > > data, so it should never be necessary to reverse it. When I'm > > > auditing an application, things like stripslashes() alert me to > > > design problems

Re: [PHP] PDO Prepared Statements and stripslashes

2010-12-20 Thread Rico Secada
ing should preserve > > data, so it should never be necessary to reverse it. When I'm > > auditing an application, things like stripslashes() alert me to > > design problems." > > > > Now, I'm always using PHP PDO with prepared statements and as such &

Re: [PHP] PDO Prepared Statements and stripslashes

2010-12-20 Thread Paul M Foster
auditing an > application, things like stripslashes() alert me to design problems." > > Now, I'm always using PHP PDO with prepared statements and as such data > with quotes gets slashed automatically by PDO when inserted into the > database. Just out of idle curiosity,

[PHP] PDO Prepared Statements and stripslashes

2010-12-20 Thread Rico Secada
Now, I'm always using PHP PDO with prepared statements and as such data with quotes gets slashed automatically by PDO when inserted into the database. When I need to pull out the data something might be slashed and I need to use stripslashes() or some str_replace() to make sure that the slas

Re: [PHP] PDO: good, popular?

2010-12-15 Thread Nicholas Kell
On Dec 14, 2010, at 5:45 PM, Govinda wrote: >> In previous experience with questions such as these, you will get >> several types of individual responses to usages of the software. Some >> good, some bad, depending on the experience level of the commenter >> with both the language and the code in

Re: [PHP] PDO: good, popular?

2010-12-14 Thread Larry Garfield
On Tuesday, December 14, 2010 1:02:33 pm Lester Caine wrote: > la...@garfieldtech.com wrote: > > I'm the DB maintainer for Drupal 7, and we rebuilt our entire DB layer > > on top of PDO. It's a rather nice API, although as others have noted it > > does not abstract away SQL entirely; it abstracts

Re: [PHP] PDO: good, popular?

2010-12-14 Thread Paul M Foster
On Tue, Dec 14, 2010 at 03:10:56AM -0800, Sam Smith wrote: > Searching for "PHP CRUD" in hopes of learning the best way to access > databases and to use PEAR or what I came across PDO. > > I want to know the communities opinion of PDO: everyone uses it or no one > uses it or it's great or what?

Re: [PHP] PDO: good, popular?

2010-12-14 Thread Govinda
In previous experience with questions such as these, you will get several types of individual responses to usages of the software. Some good, some bad, depending on the experience level of the commenter with both the language and the code in question. It's a combination of your current understand

Re: [PHP] PDO: good, popular?

2010-12-14 Thread Lester Caine
la...@garfieldtech.com wrote: I'm the DB maintainer for Drupal 7, and we rebuilt our entire DB layer on top of PDO. It's a rather nice API, although as others have noted it does not abstract away SQL entirely; it abstracts the API calls you need to use to get to SQL. We then built a layer on to

Re: [PHP] PDO: good, popular?

2010-12-14 Thread Adam Richardson
On Tue, Dec 14, 2010 at 6:10 AM, Sam Smith wrote: > Searching for "PHP CRUD" in hopes of learning the best way to access > databases and to use PEAR or what I came across PDO. > > I want to know the communities opinion of PDO: everyone uses it or no one > uses it or it's great or what? > > Thanks

Re: [PHP] PDO: good, popular?

2010-12-14 Thread la...@garfieldtech.com
I'm the DB maintainer for Drupal 7, and we rebuilt our entire DB layer on top of PDO. It's a rather nice API, although as others have noted it does not abstract away SQL entirely; it abstracts the API calls you need to use to get to SQL. We then built a layer on top of that which does abstrac

Re: [PHP] PDO: good, popular?

2010-12-14 Thread Richard Quadling
On 14 December 2010 15:45, David Hutto wrote: > From my experience with several languages, once you know the basics, > even if you do re-invent the 'wheel', so did firestone,michelin, and > goodyear, and they're not complaining. And you'll feel better for > reinventing, than using someone elses.

Re: [PHP] PDO: good, popular?

2010-12-14 Thread David Hutto
In other words, in ten years from now, even the advisors you get today will rethink their answers with 20/20/hindsight, and not think about your ignorance of technology, but their own. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] PDO: good, popular?

2010-12-14 Thread Richard Quadling
On 14 December 2010 11:10, Sam Smith wrote: > Searching for "PHP CRUD" in hopes of learning the best way to access > databases and to use PEAR or what I came across PDO. > > I want to know the communities opinion of PDO: everyone uses it or no one > uses it or it's great or what? > > Thanks > If

Re: [PHP] PDO: good, popular?

2010-12-14 Thread David Hutto
On Tue, Dec 14, 2010 at 6:10 AM, Sam Smith wrote: > Searching for "PHP CRUD" in hopes of learning the best way to access > databases and to use PEAR or what I came across PDO. > > I want to know the communities opinion of PDO: everyone uses it or no one > uses it or it's great or what? In previou

[PHP] PDO: good, popular?

2010-12-14 Thread Sam Smith
Searching for "PHP CRUD" in hopes of learning the best way to access databases and to use PEAR or what I came across PDO. I want to know the communities opinion of PDO: everyone uses it or no one uses it or it's great or what? Thanks

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

2010-10-18 Thread Stanley Sufficool
Sounds like the error message "SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (severity 9)" could be more informative, but I think this is returned by FreeTDS, not PDO. On Mon, Oct 18, 2010 at 7:35 PM, Scott Baker wrote: > On 10/18/2010 06:27 PM, Wez Furlong w

[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] Re: [PDO] Re: [PHP] PDO working via Apache but not at the command line?

2010-10-18 Thread Wez Furlong
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? Suggestion: Use "sudo -u webserverusername -s" to run

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

2010-10-18 Thread Scott Baker
On 10/18/2010 02:17 PM, a...@ashleysheridan.co.uk wrote: It's most likely because both cli and web modules are using different php.ini config files. See what the output of a phpinfo() call in both browser and command line. I didn't even think about it parsing different php.ini files. Checking

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

2010-10-18 Thread a...@ashleysheridan.co.uk
0 21:20 Subject: [PHP] PDO working via Apache but not at the command line? To: , 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. I

[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 and UPDATE problem

2010-07-21 Thread Peter Lind
On 21 July 2010 15:04, Sky Gunning wrote: > Hello > > I have a problem with a update using PDO. > (learning atm and updating a php class to use PDO) > >    private function updateUser($id) >    { >        $date = mktime(); > >        $DB = Db::getInstance(); > >        $stmt = $DB->prepare('"UPDAT

[PHP] PDO and UPDATE problem

2010-07-21 Thread Sky Gunning
Hello I have a problem with a update using PDO. (learning atm and updating a php class to use PDO) private function updateUser($id) { $date = mktime(); $DB = Db::getInstance(); $stmt = $DB->prepare('"UPDATE '. TBL_USERS .' SET date_last_action=:updateDate WHERE

[PHP] PDO with text in BLOB's

2009-09-13 Thread Lester Caine
I'm having fun with a project that has moved exclusively to PDO, and I'm now trying to restore firebird as an alternative database. The problem I am having is with text fields in firebird which are BLOB SUB_TYPE TEXT. These are essentially TEXT in other databases, and I'm used to ADOdb simply l

[PHP] PDO -> Nested selects allowed?

2009-05-27 Thread Stephen
For my photography website, I have a photo gallery, and the user first sees a list of categories. They can click down to see thumbnails, and again to see individual photographs. I want to enhance this to, with the category listing, show the first thumbnail. I have a category table, a photo t

RE: [PHP] PDO fetch_obj - question

2009-04-16 Thread MEM
Thanks. I will see. The script for my database was been generated so, I will doublecheck this uppercase "issue"... Regards, Márcio 2009/4/15 Thodoris Hi there, I’ve made a fetch_obj and, as stated on some sites, it returns a anonymous object where the properties will have the name of our col

Re: [PHP] PDO fetch_obj - question

2009-04-15 Thread talofo talofo
Thanks. I will see. The script for my database was been generated so, I will doublecheck this uppercase "issue"... Regards, Márcio 2009/4/15 Thodoris > > Hi there, I’ve made a fetch_obj and, as stated on some sites, it returns >> a anonymous >> object where the properties will have the name o

Re: [PHP] PDO fetch_obj - question

2009-04-15 Thread Thodoris
Hi there, I’ve made a fetch_obj and, as stated on some sites, it returns a anonymous object where the properties will have the name of our columns database. However, when I do this, I notice that instead of giving me the column names as they are typed on the DB I get them uppercase. So, wh

[PHP] PDO fetch_obj - question

2009-04-14 Thread MEM
Hi there, I’ve made a fetch_obj and, as stated on some sites, it returns a anonymous object where the properties will have the name of our columns database. However, when I do this, I notice that instead of giving me the column names as they are typed on the DB I get them uppercase. So, when

Re: [PHP] PDO buffered query problem

2009-02-24 Thread Chris
Thodoris wrote: Stewart Duncan wrote: Hi there, I'm having some serious problems with the PHP Data Object functions. I'm trying to loop through a sizeable result set (~60k rows, ~1gig) using a buffered query to avoid fetching the whole set. No matter what I do, the script just hangs on th

Re: [PHP] PDO buffered query problem

2009-02-24 Thread Thodoris
Stewart Duncan wrote: Hi there, I'm having some serious problems with the PHP Data Object functions. I'm trying to loop through a sizeable result set (~60k rows, ~1gig) using a buffered query to avoid fetching the whole set. No matter what I do, the script just hangs on the PDO::query() -

Re: [PHP] PDO buffered query problem

2009-02-23 Thread Chris
Stewart Duncan wrote: Hi there, I'm having some serious problems with the PHP Data Object functions. I'm trying to loop through a sizeable result set (~60k rows, ~1gig) using a buffered query to avoid fetching the whole set. No matter what I do, the script just hangs on the PDO::query() - it

[PHP] PDO buffered query problem

2009-02-23 Thread Stewart Duncan
Hi there, I'm having some serious problems with the PHP Data Object functions. I'm trying to loop through a sizeable result set (~60k rows, ~1gig) using a buffered query to avoid fetching the whole set. No matter what I do, the script just hangs on the PDO::query() - it seems the query is ru

Re: [PHP] pdo and dabase schema

2008-10-14 Thread Chris
Alain Roger wrote: Hi, is there a way with PDO class to not have: - to execute a simple SET search_path TO myschema; can you alter the postgres users path? alter user set search_path to new_schema, current_schemas(); or some variation on that. - and after to fletch another SQL request, li

[PHP] pdo and dabase schema

2008-10-14 Thread Alain Roger
Hi, is there a way with PDO class to not have: - to execute a simple SET search_path TO myschema; - and after to fletch another SQL request, like select to be sure that the SQL statement will be perform on this schema ? (basically i want to do it in 1 step) because i tried to specify the schema i

[PHP] PDO

2008-10-14 Thread Alain Roger
Hi, i'm currently using PDO as it seems better than any other pg_connect and so on... however, i experience issue testing it. for example the following code returns me the correct records (count and records themselve) > $sql ="SELECT * FROM sewe.languages;"; > > $result = DatabaseHandler::Pre

Re: [PHP] PDO, sqlite write requests (INSERT) don't working

2008-08-20 Thread Ashley Sheridan
Hi KLEIN, I think the problem is where you are connecting to your database. I've not used SQL lite before, but the function spec says that you have too many arguments. It suggests connecting like this: if ($db = new SQLiteDatabase('filename')) Also, do you need to specify the sqlite: protocol bef

[PHP] PDO, sqlite write requests (INSERT) don't working

2008-08-20 Thread KLEIN Stéphane
Hi, it's the first time I use sqlite in PHP script. All read requests work perfectly but I don't get on execute write requests. Example : getMessage(); } var_dump($dbh); $firstname = "foobarbbar"; $lastname = "barbarbar"; try { $sql = "INSERT INTO contact (firstname, lastname) VALUES('

Re: [PHP] pdo compilation question

2008-08-19 Thread Jochem Maas
Thijs Lensselink schreef: Quoting Tim Rupp <[EMAIL PROTECTED]>: ... Thanks in advance, Tim you are loading extensions of an older PHP version. Do an ls -als on /usr/local/lib/php. you will find a directory with a higher date. That's your new extension path. Just change the location in

Re: [PHP] pdo compilation question

2008-08-19 Thread Thijs Lensselink
Quoting Tim Rupp <[EMAIL PROTECTED]>: Hi list, I hope this is the right area to ask, I'm trying to compile PDO support in 5.2.6 and am following the instructions here http://us2.php.net/manual/en/pdo.installation.php My compile line is the following ./configure --enable-force-cgi-redirect

[PHP] pdo compilation question

2008-08-18 Thread Tim Rupp
Hi list, I hope this is the right area to ask, I'm trying to compile PDO support in 5.2.6 and am following the instructions here http://us2.php.net/manual/en/pdo.installation.php My compile line is the following ./configure --enable-force-cgi-redirect \ --disable-rpath \ --wi

Re: [PHP] PDO prepared statements and LIKE escaping

2008-08-05 Thread Andrew Ballard
On Mon, Aug 4, 2008 at 1:36 AM, Larry Garfield <[EMAIL PROTECTED]> wrote: > Hi folks. I am trying to figure out the best way to handle an interesting > issue in PDO prepared statements. Consider: > > $search = 'mystring'; > > $stmt = $dbh->prepare("SELECT * FROM mytable WHERE myfield LIKE :myfiel

[PHP] [PHP-DEV] Re: [PHP] PDO prepared statements and LIKE escaping

2008-08-05 Thread Lester Caine
Sorry - switched address to the wrong list :( *I* hate reply not going to the right place - but one of these days I switch to something that just ignores the on board miss direction ;) Larry Garfield wrote: I'm building a multi-database system, although my main targets are MySQL, Postgres, and

Re: [PHP] PDO prepared statements and LIKE escaping

2008-08-04 Thread Larry Garfield
I'm building a multi-database system, although my main targets are MySQL, Postgres, and SQLite. How would those handle something like "a string that ends in 100%"? On Monday 04 August 2008 6:18:24 pm Asher Snyder wrote: > Depending on what database you're using you might be able to use LIKE >

Re: [PHP] PDO prepared statements and LIKE escaping

2008-08-04 Thread Asher Snyder
Depending on what database you're using you might be able to use LIKE while maintaining security. For instance PostgreSQL has the functions quote_ident(), and quote_literal() which would allow you to use LIKE since these functions would automatically make the string suitable for comparison.

Re: [PHP] PDO prepared statements and LIKE escaping

2008-08-04 Thread Adam Richardson
Like I said, I'm not 'especially pleased' with any idea up until now. I'm certainly open to any other ideas. Adam On Mon, Aug 4, 2008 at 6:57 PM, Larry Garfield <[EMAIL PROTECTED]>wrote: > > Hm. So your solution is "don't use LIKE"? I can't say I'm wild about > that. :-/ > > --Larry Garfield

Re: [PHP] PDO prepared statements and LIKE escaping

2008-08-04 Thread Larry Garfield
Hm. So your solution is "don't use LIKE"? I can't say I'm wild about that. :-/ --Larry Garfield On Mon, 4 Aug 2008 15:49:52 -0400, "Adam Richardson" <[EMAIL PROTECTED]> wrote: > Larry, > > I agree that having to escape values in a stored procedure does run > counter > to expectations. It's l

Re: [PHP] PDO prepared statements and LIKE escaping

2008-08-04 Thread Adam Richardson
Larry, I agree that having to escape values in a stored procedure does run counter to expectations. It's likely other developers have the potential for short-circuiting their LIKE conditions without realizing it. I've dealt with this issue, too, and haven't been especially pleased with any of th

RE: [PHP] PDO prepared statements and LIKE escaping

2008-08-04 Thread Boyd, Todd M.
> -Original Message- > From: Andrew Ballard [mailto:[EMAIL PROTECTED] > Sent: Monday, August 04, 2008 10:49 AM > To: PHP General list > Subject: Re: [PHP] PDO prepared statements and LIKE escaping > > On Mon, Aug 4, 2008 at 11:35 AM, Larry Garfield > <[EMAIL PR

Re: [PHP] PDO prepared statements and LIKE escaping

2008-08-04 Thread Larry Garfield
On Mon, 4 Aug 2008 11:48:39 -0400, "Andrew Ballard" <[EMAIL PROTECTED]> wrote: > On Mon, Aug 4, 2008 at 11:35 AM, Larry Garfield <[EMAIL PROTECTED]> > wrote: >> >> On Mon, 04 Aug 2008 08:33:44 +0200, Per Jessen <[EMAIL PROTECTED]> wrote: >>> Larry Garfield wrote: >>> IIRC, the way in SQL to c

Re: [PHP] PDO prepared statements and LIKE escaping

2008-08-04 Thread Andrew Ballard
On Mon, Aug 4, 2008 at 11:35 AM, Larry Garfield <[EMAIL PROTECTED]> wrote: > > On Mon, 04 Aug 2008 08:33:44 +0200, Per Jessen <[EMAIL PROTECTED]> wrote: >> Larry Garfield wrote: >> >>> IIRC, the way in SQL to circumvent that is to convert "100%" into >>> "100%%". However, that does rather defeat th

Re: [PHP] PDO prepared statements and LIKE escaping

2008-08-04 Thread Per Jessen
Larry Garfield wrote: > Actually in most cases in PHP you don't get much performance. Exactly. > What you do get is added security, because prepared statements are > cleaner than cleaner and more reliable than string escaping. Of > course, then we run into the % problem above. I don't really

Re: [PHP] PDO prepared statements and LIKE escaping

2008-08-04 Thread Larry Garfield
On Mon, 04 Aug 2008 08:33:44 +0200, Per Jessen <[EMAIL PROTECTED]> wrote: > Larry Garfield wrote: > >> IIRC, the way in SQL to circumvent that is to convert "100%" into >> "100%%". However, that does rather defeat the purpose of a prepared >> statement if I have to do my own escaping anyway, does

Re: [PHP] PDO prepared statements and LIKE escaping

2008-08-03 Thread Per Jessen
Larry Garfield wrote: > IIRC, the way in SQL to circumvent that is to convert "100%" into > "100%%". However, that does rather defeat the purpose of a prepared > statement if I have to do my own escaping anyway, does it not? Depends on what you perceive the purpose of the prepared statement to b

[PHP] PDO prepared statements and LIKE escaping

2008-08-03 Thread Larry Garfield
Hi folks. I am trying to figure out the best way to handle an interesting issue in PDO prepared statements. Consider: $search = 'mystring'; $stmt = $dbh->prepare("SELECT * FROM mytable WHERE myfield LIKE :myfield"); $stmt->execute(array(':myfield' => $search . '%')); The above will search for

Re: [PHP] PDO Question. Number of rows returned

2008-07-13 Thread Bastien Koert
On Sun, Jul 13, 2008 at 11:12 AM, Stephen <[EMAIL PROTECTED]> wrote: > Bastien Koert wrote: > > On Sun, Jul 13, 2008 at 10:30 AM, Stephen <[EMAIL PROTECTED]> <[EMAIL > PROTECTED]> wrote: > > > > Kevin Waterson wrote: > > > > I am switching to PDO and can't find an equivalent to mysql_num_rows.

Re: [PHP] PDO Question. Number of rows returned

2008-07-13 Thread Stephen
Bastien Koert wrote: On Sun, Jul 13, 2008 at 10:30 AM, Stephen <[EMAIL PROTECTED]> wrote: Kevin Waterson wrote: I am switching to PDO and can't find an equivalent to mysql_num_rows. Am I missing something silly? Or is there a change of thinking needed for PDO? How should I d

Re: [PHP] PDO Question. Number of rows returned

2008-07-13 Thread Bastien Koert
On Sun, Jul 13, 2008 at 10:30 AM, Stephen <[EMAIL PROTECTED]> wrote: > Kevin Waterson wrote: > >> I am switching to PDO and can't find an equivalent to mysql_num_rows. >>> >>> Am I missing something silly? >>> >>> Or is there a change of thinking needed for PDO? >>> >>> How should I determine how

Re: [PHP] PDO Question. Number of rows returned

2008-07-13 Thread Stephen
Kevin Waterson wrote: I am switching to PDO and can't find an equivalent to mysql_num_rows. Am I missing something silly? Or is there a change of thinking needed for PDO? How should I determine how many rows a query returned? PDO returns an array, sizeof/count will get you home I wou

Re: [PHP] PDO Question. Number of rows returned

2008-07-12 Thread Kevin Waterson
This one time, at band camp, Stephen <[EMAIL PROTECTED]> wrote: > I am switching to PDO and can't find an equivalent to mysql_num_rows. > > Am I missing something silly? > > Or is there a change of thinking needed for PDO? > > How should I determine how many rows a query returned? PDO returns

[PHP] PDO Question. Number of rows returned

2008-07-12 Thread Stephen
I am switching to PDO and can't find an equivalent to mysql_num_rows. Am I missing something silly? Or is there a change of thinking needed for PDO? How should I determine how many rows a query returned? Thanks Stephen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: h

[PHP] PHP + PDO + MySQL + Stored Procedure + PREPARE = Problem

2007-08-31 Thread Uzed
Hi all, I've found a bug when working on a PHP script using a PDO connector. When I made a Store Procedure using the PREPARE statement something messed up the result im my PHP script. Please go to my blog http://huzed.com/zed/?p=21 and see code. Tanks for help. ZED -- PHP General Maili

Re: [PHP] PDO::ATTR_TIMEOUT script specific?

2007-08-07 Thread Richard Lynch
On Thu, August 2, 2007 1:49 pm, Ken Tozier wrote: > I have a script that needs to get ad information from two different > sources, a primary and fallback. The primary source is a high traffic > (and poorly designed/unpartitioned MSSQL database) with millions of > records that gets locked up when 'c

Re: [PHP] PDO lastInsertID always returns zero for MySQL tables [SOLVED]

2007-08-05 Thread Ken Tozier
Disregard. After more head scratching I found that I was branching to the 'insert' handler without calling this->db->query($query). On Aug 5, 2007, at 9:18 PM, Ken Tozier wrote: Hi In the past, I always used mysql_insert_id() and never had a problem, but now that I'm using PDO, I'm find

  1   2   >