pdo

Do prepared statements in PDO really increase security?

纵然是瞬间 提交于 2019-12-24 04:46:06
问题 I wonder if those prepared statements of PDO really increase security, or if they are just a "cheap" text-replace in the query. The point of prepared statements actually is, that whatever gets inserted as parameter, will not be parsed by the DBMS as part of the instructions itself, so a parameter like "'; DROP TABLE foobar;" has no effect and does not break the query. Does anyone know this in detail? I thought to use PDO with prepared statements for preventing sql injection. It turns out that

In PHP getting “Class 'PDO' not found” error while trying to connect to Oracle DB

試著忘記壹切 提交于 2019-12-24 04:24:13
问题 I am trying to connect to my oracle database using PDO but I am getting Class PDO not found error. I have checked that PDO is enabled and it appears so. Still I am not able to trace why I am getting this error. Here is my configure command, cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-snapshot-template=d:\php-sdk\snap_5_2\vc6\x86\template" "--with-php-build=d:\php-sdk\snap_5_2\vc6\x86\php_build" "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk

Enabling PDO OCI

人盡茶涼 提交于 2019-12-24 04:22:10
问题 I've tried to install OCI, so I can use new PDO("oci:dbname... After 1,5h of fight I've installed oracle instantclient (basic and sdk) and then oci for php (as described here http://ubuntuforums.org/showthread.php?t=92528). Now I'm a bit confused because my PHPinfo tells that OCI8 Support is enabled, but in PDO section there's only odbc in "PDO drivers" section. When did I go wrong? P.S. I've got XUBUNTU 12.10 and following packets installed: php-pear, php5, php5-cli, php5-common, php5-dbg,

Enabling PDO OCI

╄→尐↘猪︶ㄣ 提交于 2019-12-24 04:22:07
问题 I've tried to install OCI, so I can use new PDO("oci:dbname... After 1,5h of fight I've installed oracle instantclient (basic and sdk) and then oci for php (as described here http://ubuntuforums.org/showthread.php?t=92528). Now I'm a bit confused because my PHPinfo tells that OCI8 Support is enabled, but in PDO section there's only odbc in "PDO drivers" section. When did I go wrong? P.S. I've got XUBUNTU 12.10 and following packets installed: php-pear, php5, php5-cli, php5-common, php5-dbg,

PDO not binding placeholders

元气小坏坏 提交于 2019-12-24 04:18:46
问题 I am trying to change my log in script from mysql to PDO . For the rest of my script all seams to be going well apart from this parts and I simply cant see why. I have the below code ... $pasword=md5($_POST['password']); $email=$_POST['email']; .... $query ="SELECT id FROM guests WHERE email=':eml' AND password =':pwd' AND lead_guest=17"; // $param2=array(':eml'=>$email,':pwd'=>$pasword); $state=$dbh->prepare($query); $state->bindParam(':eml',$email); $state->bindParam(':pwd',$pasword);

error updating record in database

旧巷老猫 提交于 2019-12-24 04:12:17
问题 Hello I am trying to submit a update request through my form and postman, but i keep getting the same thing in the response as it worked updated Nothing is changing in my db at all. here my function function update(Request $request, Response $response) { $id = $request->getAttribute('id'); $name = $request->getParam('name'); $start = $request->getParam('start'); $end = $request->getParam('end'); $sql = "UPDATE table_timing SET name = :name, start = :start, end = :end WHERE table_timing.id =

Connecting to MSSQL server via php-pdo?

本小妞迷上赌 提交于 2019-12-24 03:41:48
问题 I'm unable to connect to MSSQL database on smarterasp.net domain. I'm using: PHP Tools for Visual Studio Here is the code: <?php try { $conn = new PDO("mssql:host=host_name_string;dbname=database_name_string", "username_string", "password_string"); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connected successfully"; } catch(PDOException $e) { echo "Connection failed: " . $e->getMessage(); } ?> and the error caught by the

php data from database is not shown after search

社会主义新天地 提交于 2019-12-24 03:28:14
问题 I am new to php and trying to make a search function on name and date but I have a problem. My problem is that the search function sees all the effected rows from the search but does not show them. I load all the data from the database as default on my page and I want that if the $_GET['go'] from search isset that all the default data isn't shown anymore and only the results from the search are shown. Now he always shows that default data. Except from the $_GET['by'] there is no data shown. I

PHP comet usleep blocking apache mpm?

﹥>﹥吖頭↗ 提交于 2019-12-24 03:27:52
问题 I've a comet there I run an while loop in this way $items = $statement->fetchAll();//statement is a PDO Statement $iteration = 0; while(count($items) == 0 && $iteration < 100){ $items = $statement->fetchAll(); usleep(10000); ++$iteration; } When the comet runs I can see all other HTTP requests are pending. even non-database requests are pending. Why ? 回答1: You need to manually commit using PDO::commit as the request are being hold in a transaction. Please see the docs about this behavior:

Differentiate between 'no rows were affected' and rows succesfully UPDATEd--to same value (MySQL and PHP)

谁说胖子不能爱 提交于 2019-12-24 03:25:36
问题 I am executing SQL (MySQL) commands from PHP. There are several possible outcomes to each execution: Record updated to new value Record updated, but values happen to be the same Record finds no rows to update (ie, no rows match the WHERE clause) I am wondering how to differentiate between #'s 1 and 3: both cases return zero as the number of rows being affected, so: $result = $db->exec($statement) will have $result == 0 in both cases. How can I tell the difference? EDIT: I meant to ask how to