Questions tagged as 'pdo'

2
answers

Display PDO query data in JSON format

I try to get the data from a query and print it on the screen but it does not show anything. $pdo=new PDO("mysql:dbname=usuario;host=localhost","root","root"); $statement=$pdo->prepare("SELECT * FROM usuario WHERE estado = 1 ORDER BY idusua...
asked by 02.03.2017 / 02:04
1
answer

Problem when verifying that my user is in the ORACLE database

Is there any kind of conflict with rowCount? The sentence I understand is fine, and I'm using PDO, which also did not give me problems before. The field in the database is VARCHAR2. I attach my code: $user = 'pepito' $con = conne...
asked by 13.02.2018 / 13:41
1
answer

PDO fetch array

I would like to know if there is any way to rename the keys of an associative array that is given by PDOStatement :: fetch. The sentence that I prepare and execute in SQL does not come to the case in itself (although if they require it, I can ad...
asked by 04.01.2018 / 20:30
2
answers

Error inserting data with PDO and POO

Greetings community. I am developing an application using PDO, I am starting and I have had a problem when inserting records in the database. Next I put the functions that I am using and the error that is giving me. First my controller receiv...
asked by 31.12.2017 / 01:03
1
answer

Messages with php and ajax

At the moment of wanting to do a fetch_array send me this error and I can not solve it    Fatal error: Call to undefined method PDOStatement :: fetch_array () my code so far is the following <?php $query = "SELECT * FRO...
asked by 26.06.2017 / 23:13
2
answers

show PHP PDO data

I'm trying to show some results using PDO. Until now I used mysqli_conect() for the connection to the database. I guess the error is found by showing the results in the 'foreach ()' Someone would know how to correct the fault? Thanks in a...
asked by 09.05.2017 / 19:15
1
answer

PHP PDO Rollback does not work

Hi, I am trying to execute a PDO Rollback in a function where I involve several tables and there are several insert and updates. I am working with MVC and POO. Maybe I have something wrong with my structure, if so, could you tell me where...
asked by 31.08.2016 / 21:24
2
answers

Object of class Conn could not be converted to string in

The following error is presented to me when designing queries to the database, I enclose the source code: Validations.php: <?php session_start(); if(isset($_SESSION['usuario'])){ header('Location: vistas/home.php'); } if($_SERVER['REQ...
asked by 26.11.2018 / 03:22
1
answer

Error in sentence usanto query ()

I'm doing an internal query and I want to get a field ( idperiodo which is integer ), there should only be one record with the field Active that's why I use limit 1 . I have this code: public function buscar_campo() { try {...
asked by 06.05.2018 / 15:37
2
answers

I DO NOT GET ANY MYSQL REGISTER IN PHP

I've been working with php for some time and trying to make the MYSQL code work inside PHP, I'm working with PDO but at the moment I want to get the records from my database and put the print_r ($ variable); shows me an empty array. <?php...
asked by 09.08.2018 / 18:07