|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-03-08 06:19 UTC] shadda at gmail dot com
Description:
------------
Using prepared statements causes my script to die, in two ways depending on how I use them. If I use bindParam() the script dies silently (no error, no exception thrown, even with PDO::ATTR_ERRMODE set to ERRMODE_EXCEPTION) and I am unable to output anything (above or below). When I pass the parameter through PDOStatement::execute(), I receive the following error:
SQLSTATE[42P18]: Indeterminate datatype: 7 ERROR: could not determine data type of parameter $1
Reproduce code:
---------------
<?php
//First Example
$query = $db->prepare("select font_name, path from fonts_list where id = ?");
$query->execute( array($_GET['foo']) );
//Produces error (see above)
//Second example
$query = $db->prepare("Select font_name, path from fonts_list where id = :id");
$query->bindParam(':id', $id);
$id = $_GET['foo'];
$query->execute();
//Kills the script. No Error. Nothing error log.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 01 06:00:01 2025 UTC |
Excuse the delay; I'm using PDO_PGSQL driver, and yes I've tried the latest snapshot from snaps.php.net. I just built it, and tested the code. Gluttony:/home/shadda/php5.1-200603081930# php -r ' try { $db = new PDO("pgsql:host=localhost;dbname=carbonix", "xoom", "1914"); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $q = $db->prepare("select ?"); $q->execute( array(1) ); var_dump($q->fetch()); } catch (Exception $e) { echo $e->getMessage(); }' Returns: SQLSTATE[42P18]: Indeterminate datatype: 7 ERROR: could not determine data type of parameter