note 113908 added to pdostatement.bindparam

From: Date: Mon, 16 Dec 2013 11:56:38 +0000
Subject: note 113908 added to pdostatement.bindparam
Groups: php.notes 
Request: Send a blank email to php-notes+get-197950@lists.php.net to get a copy of this message
http://technet.microsoft.com/en-us/library/ff628166(v=sql.105).aspx When binding null data to server columns of type varbinary, binary, or varbinary(max) you should specify binary encoding (PDO::SQLSRV_ENCODING_BINARY) using the $driver_options. See Constants for more information about encoding constants. Support for PDO was added in version 2.0 of the Microsoft Drivers for PHP for SQL Server. <?php $db = new PDO('sqlsrv:server=SQLSERVERNAME;Database=own_exchange', 'user', 'password'); $sql = "INSERT INTO dbo.files(file_name, file_source) VALUES(:file_name, :file_source)"; $stmt = $db->prepare($sql); $stmt->bindParam(":file_name", $files->name, PDO::PARAM_STR); $stmt->bindParam(":file_source", file_get_contents($files->tempName), PDO::PARAM_LOB, 0, PDO::SQLSRV_ENCODING_BINARY); $stmt->execute(); ?> ---- Server IP: 72.52.91.14 Probable Submitter: 72.52.91.14 ---- Manual Page -- http://php.net/manual/en/pdostatement.bindparam.php Edit -- https://master.php.net/note/edit/113908 Del: integrated -- https://master.php.net/note/delete/113908/integrated Del: useless -- https://master.php.net/note/delete/113908/useless Del: bad code -- https://master.php.net/note/delete/113908/bad+code Del: spam -- https://master.php.net/note/delete/113908/spam Del: non-english -- https://master.php.net/note/delete/113908/non-english Del: in docs -- https://master.php.net/note/delete/113908/in+docs Del: other reasons-- https://master.php.net/note/delete/113908 Reject -- https://master.php.net/note/reject/113908 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#197950) next »