pdo

Doctrine raw sql and prepared statements

I've got a Doctrine_RawSql query using prepared statements. However, they seem to get ignored when the SQL query is generated. But If I leave out the token values, I get an exception about number of bound variables not matching (so it's at least trying to sub them in). If I include these values inline, is Doctrine doing anything behind ...

MySql driver not installed error for Zend application

I am trying to get my ZEND application up on my apache server running on UNIX. Initially my host didnot give PDO support ,and i got it enabled by requesting them with a mail.But now I am getting an error saying The mysql driver is not currently installed The stack trace is like: An error occurred Application error Exception informatio...

List of PHP native_type's for PDO getColumnMeta()

I am using the PDO Database Abstraction library to make sure my code is portable. However, I now find that I need column information so I turned to the PDOStatement->getColumnMeta() method hoping it would be somewhat standardized - but from what I have found it actually seems open-ended. For example, when calling that method from SQLite...

What is PDO scrollable cursor?

What is "Fetching rows with a scrollable cursor" all about? ...

Compiling PHP 5.1.6 with PDO MySQL

I originally asked this question on ServerFault and haven't got any response and I figure it's programming related so, here goes... A while ago a large client of ours moved to a single hosting provider who spec'd out a software environment which would be consistent accross all the live servers. Amongs other things this includes Apach...

How to Set a Value to NULL when using Zend_Db

When performing UPDATE and INSERT queries using Zend_Db, I frequently need to set values equal to NULL (not ''). However, the default behavior of Zend_Db::insert() and Zend_Db::update() seems to be that values that are empty are translated into empty strings ('') and put into the database as such. Does anyone know of way to actually fo...

Trouble getting MAMP to work with PDO-MySQL

Problem: Doctrine test application isn't working because of driver issue. Setup: Mac OS X 10.5.7 (not server), MAMP 1.7.2, Doctrine 2.2.1, PHP 5.2.6 I am following the doctrine documentation to try to set up a development environment on my local machine. The output of running the page from the web (through MAMP) shows an empty screen (...

PDO Insert Help

Hello all, I'm having a bit of trouble inserting into a sqlite3 database with pdo. You'll have to excuse my ignorance with PDO, it seems so foreign coming from Python's database interface. So here's my problem. I have a simple insert: $dbh = new PDO('sqlite:vets.db'); $count = $dbh->exec("INSERT INTO vets(name,email,clinic,streetna...

PDO Prepared Inserts multiple rows in single query

Hello, I am currently using this type of SQL on MySQL to insert multiple rows of values in one single query: INSERT INTO tbl (key1,key2) VALUES ('r1v1','r1v2'),('r2v1','r2v2'),... On the readings on PDO PDO, the use prepared statements should give me a better security than static queries. I would therefore like to know whether ...

PDO: bindParam versus bindValue

What is the difference between bindParam and bindValue for PDO in PHP? http://www.php.net/manual/en/pdostatement.bindparam.php http://www.php.net/manual/en/pdostatement.bindvalue.php ...

how to get numeric types from mysql using PDO

I'm using PDO and mysql, for some reason when getting values from the DB that are int type, the PDOStatement is returning a string representation of the number and not a value of numeric type, how do I prevent this from happening? I noticed there is a attribute of the PDO class: PDO::ATTR_STRINGIFY_FETCHES that is supposed to take care ...

Connecting through MySQL socket with Zend Framework

I have recently started using Zend Framework. I started developing on my local XAMPP server which went fine but when I uploaded to my 1and1 account, I keep getting the following error: Message: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) I have tried changing the...

PDO Statement does nothing?

$columns = "name, address, city, state, zip"; $values = "'$name', '$address', '$city', '$state', '$zip'"; $query = "insert into customer values ($values)"; $statement = $dbh->prepare($query); $statement->execute(); So I am completely new to this. Kindergarten examples and baby talk will not be offensive! : ) The form executes with no ...

Preparing SQL Statements with PDO

My code looks like this: // Connect to SQLite DB DB('/path/to/sqlite.db'); DB('BEGIN TRANSACTION;'); // These loops are just examples. for ($i = 1; $i <= 10000; $i++) { for ($j = 1; $j <= 100; $j++) { DB('INSERT INTO "test" ("id", "name") VALUES (?, ?);', $i, 'Testing ' . $j); } } DB('END TRANSACTION;'); And here i...

Why does this pdo::mysql code crash on windows??

Why does this pdo::mysql code crash on windows??? <?php $username = "root"; $password = ""; try { $dsn = "mysql:host=localhost;dbname=employees"; $dbh = new PDO($dsn, $username, $password); $dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, FALSE); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connected to datab...

PDO Catch result

How does one catch/echo the insert results? I have a insertion statement that say that no errors occured but nothing is actually placed in the database. ...

Zend_Db query Mysqli prepare error: Operand should contain 1 column(s)

I have a problem with a query that works in phpmyadmin but not with Zend_db. You can read about the query in http://stackoverflow.com/questions/1268376/sql-statement-with-several-joins I have these tables Post ID entry Category ID name CategoryBinding ID postID categoryID And this is my php code: clas...

Install PDO on OS X Leopard

What's the easiest way to install PDO on the default php installation of OS X Leopard? I'm trying to get ModX running. ...

prepared parameterized query with PDO

New to this new and secure way of handling SQL's in PHP and MySql driven web based application, to secure the code from SQL injections. I am planning to start using mysqli with PDO. Can anyone please outline how should i get started and proceed. Any reference to any article will also be helpful. Thanks in advance. ...

How to detect an unavailable database using PHP PDO?

I am using PHP to create a process that monitors our database and puts up a maintenance page on our website if the database is down. I'm using PDO and Oracle. I am trying to use one database connection and query it once a minute, alerting people if there's a problem. However, if the database goes down, the script waits 15 minutes befo...