Symfony 3 dont find pdo_mysql driver

My symfony project do not find pdo_mysql driver. I am using debian server. The same config works on OSX ok but not here. When I use php -m command it show driver and also the php -i |grep pdo_mysql show: /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini, API...
more »

2017-01-11 22:01 (2) Answers

Slice an array with an inline PDO query

I'm trying to slice an array but getting an error "array_slice() expects parameter 1 to be array" Will appreciate any help! foreach(array_slice(($pdo->query($query)), 0, 3) as $row_Results) { $pic_id = $row_Results['pic_id']; ...
more »

2017-01-11 17:01 (1) Answers

PDO/Codeigniter error with prepare

I'm trying to insert a new row into my database using PDO and codeigniter. Here's my function : function addStudent($st, $img){ $stat = $this->db->prepare('INSERT INTO students (sName, phone, email, image) VALUES (:sName, :phone, :em...
more »

2017-01-11 11:01 (1) Answers


I tryed every way but it does not work option.php if (isset($_GET['agentsdelete'])) { $agents_id=$_GET['agents_id']; $delete=$db->prepare("DELETE FROM agents WHERE agents_id=:agents_id"); $control=$delete->execute(array( 'agents_id'...
more »

2017-01-11 10:01 (1) Answers

There is already an active transaction

i have a code that use commit and rollback $pdo = new dbpdo(); $fields = ['id','last','first']; $values = [NULL,'asd','asd']; //$pdo->db->beginTransaction(); try { $pdo->db->beginTransaction(); //echo 'co...
more »

2017-01-11 07:01 (0) Answers

PDO exec() creating table

I am studying PDO with the example in w3schools. The question I would like to ask is when I open the file (Click here for the code) on server, the browser shows SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'myguests' already ex...
more »

2017-01-11 05:01 (0) Answers

How to lock an SQL row with PDO

I'm trying to lock a row of a table for updates only, while allowing reading, but the following code isn't locking the row. I executed "code1" followed by "code2" without commiting code1, through a POST request. So each of those codes lies in a disti...
more »

2017-01-11 01:01 (1) Answers

Error in MySQL and PHP

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead. connect.php error in: <?php function connections(){ $user="root"; $pass=""; $server="localhost"; $db="db"; $con=mys...
more »

2017-01-10 19:01 (1) Answers

Can't call PHP function multiple times

I am trying to fix my previous problem with an extra query. However, when I am trying to make multiple calls to my PHP function it just shows the first one and not both. Code: <?php function test($colour) { $pdo = new PDO("pgsql:host=local...
more »

2017-01-10 18:01 (1) Answers

PDO always throws exception

OS: Debian 8 "Jesse", PHP 7.0, mySQL 5.5.53 As the title says, I've created a PDO object trying to demo the basic functionality to myself with locahost, and it always throws an exception regardless of whether or not the database request is correct o...
more »

2017-01-10 18:01 (1) Answers

PhpStorm doesn't highlight pdo functions

i use a DB class with PDO. <?php define('DB_HOST', 'localhost'); define('DB_NAME', ''); define('DB_USER', ''); define('DB_PASS', ''); define('DB_CHAR', 'utf8'); class DB { protected static $instance = null; protected function __constru...
more »

2017-01-10 18:01 (0) Answers

signup page created using pdo php it gives error

I am learning oops concepts in php. I created Login/Signup/dbconfig pages using PHP PDO. DBconfig.php is working well but signup page gives below error. Fatal error: Uncaught Error: Call to undefined method dBase::prepare() in D:\xampp\htdocs\ph...
more »

2017-01-10 15:01 (1) Answers

PHP PDO Select multiple rows

I'm trying to select multiple rows from MySQL in PHP. I don't want to use mysql_..., but PDO. I have a table with 'Name' and 'Family'. If two or three people are family, they have the same number by Family. If there is't any family, the Family box is...
more »

2017-01-10 15:01 (0) Answers

pdo Prepared statements and mysql

I can't execute my sql in pdo,but it's work without pdo. try{ $Attr = 'abc'; $stmt = $dbh->prepare("ALTER TABLE num ADD COLUMN ? VARCHAR(30)"); $stmt->bindValue(1,$Attr); $stmt->execute(); print_r...
more »

2017-01-10 14:01 (0) Answers

total array sum using pdo

I'm trying to get total price from cart table. The product_price in other table which is product. I'm only getting the latest price not the total price. Thanks // function total_price (){ $total = 0; global $db; $ip = getIp(); $sql = $d...
more »

2017-01-10 04:01 (1) Answers

php pdo bind list of values to a parameter

I'm trying to find information about how (if it's at all possible) to pass multiple values to a parameter in an oracle sql query through the pdo class in php. For instance: I have this query: select * from myTable where myColumn in (:values); Fr...
more »

2017-01-09 21:01 (0) Answers

PDO SQL Multiple Queries

i got alot of help in my other Question but my problem doesn't relate to said question anymore. I'm completely new to PDO but tried some stuff. I want to read from 2 different tables. It works on one side. On the other it throws me: " Notice: Und...
more »

2017-01-09 21:01 (0) Answers

Compiling a new pdo PDO_4D

We have 32 client databases, some are big, with millions of records (V.11. Currently, hosted and build on Mac's). I have build a website on Windows 2012 64x Server and included last version of PDO with PHP version that was stated (Xamp 2.5 with PHP/5...
more »

2017-01-09 12:01 (0) Answers

PHP PDO Update Multiple Tables

As a novice coder with PHP - PDO, I have been trying to prepare a simple page for myself but I cannot succeed it. Now I am trying to update my tables via my edit page which shows inputs within a form but keep receiving errors. And no matter if I try ...
more »

2017-01-09 10:01 (0) Answers

php pdo query range select with value "Above"

$stmt = $dbh->prepare("SELECT * FROM salary_table WHERE " . "(cast(min_compensation as decimal(10, 6)) <= :name AND :name <= cast(max_compensation as decimal(10, 6)) OR cast(min_compensation as decimal(10, 6)) <= :name AND LOWER(max_compe...
more »

2017-01-09 09:01 (0) Answers

PHP : PDO Problems in Calling Out Variables

Greeting. I'm using PDO to connect to a database. I'm having a problem when calling the parameter from stored procedures. The code was from here This is the code : <?php // PDO $pdo = new PDO('odbc:test'); print '<h3>PDO: s...
more »

2017-01-09 08:01 (0) Answers

Pass multiple rows to UDF in TSQL using PHP PDO

I currently have a query in TSQL that takes in a collection of product IDs and associated prices and calculates discounted pricing. At the moment, the product IDs and initial pricing are in the database, and the query I've written joins against those...
more »

2017-01-08 06:01 (0) Answers

Rating correct record PHP SQL

I have no idea how to make "plus / minus" rating to the correct record, I tried to do this in while loop, which shows all the records, but it's rating only the first record. How to refer to correct record? I'm newbie in PHP. Here's my code: if (isse...
more »

2017-01-07 19:01 (2) Answers