Questions tagged as 'pdo'

1
answer

Update records using PDO

Good morning everyone, I have the following problem: I have a form where I retrieve a record from a database and an update button to edit the record in question. The part of the form where I show the data of any registry works well, the pa...
asked by 27.12.2016 / 13:52
3
answers

How to count the last records that fit a condition?

I want to count the last records when they meet that: its estado equals 1 if the usuario_id equals 5, and the test_id equals 1 The maximum number of records to count is only 3. These records I have in a table w...
asked by 30.10.2016 / 00:48
2
answers

Update Total Accumulated

I need to update the cumulative sales of all the clients in the accumPurchases field, for which I try to add all the invoices of each one and record this value there UPDATE contacts SET accumPurchases = (SELECT SUM(inv_total...
asked by 28.12.2018 / 19:52
1
answer

Warning: Invalid argument supplied for foreach () when passing a resultset

   Warning: Invalid argument supplied for foreach () in   C: \ xampp \ htdocs \ course_php \ pdo.php on line 9 My code is: <?php try { $conexion = new PDO('mysql:host=localhost;dbname=curso', 'root', ''); echo "conexion exitos...
asked by 28.09.2018 / 22:10
1
answer

LOGIN WITH PRIVILEGE PHP PDO DOES NOT WORK ME - I CAN BE HELPED [closed]

This is the code that fails updated, attached image db <?php session_start(); error_reporting(0); include('includes/config.php'); if($_SESSION['alogin']!=''){ $_SESSION['alogin']=''; } if(isset($_POST['log...
asked by 29.10.2018 / 11:40
1
answer

why the sentence fails with PDO

I am doing a sentence with PDO in PHP and an error occurs when assigning the values. $request = [ 'lang' => ['value'=>'es','type'=>PDO::PARAM_STR, 'length'=>2], 'page' => ['value'=>'home','type'=>PDO::PARAM_STR,...
asked by 09.08.2018 / 10:04
1
answer

When trying to insert data into the DB I get an error [HY093]

The fact is that I am trying to insert users through PDO and CRUD and this is generating an error which I can not solve. The error is exactly this    SQLSTATE [HY093]: Invalid parameter number: parameter was not defined File containing...
asked by 22.03.2018 / 12:40
1
answer

Error uploading data to MySQL using PDO

Today I am trying to upload data from a registration form to my db using PDO, I get "Error" which is the return that I have established when sending data. <?php require_once('models/connection.php'); class Data extends Connection {...
asked by 14.01.2018 / 00:21
2
answers

Modify value that changes another value in SQL

My Update function: public function Update($pcosto, $user_id) { $query = $this->db->prepare("UPDATE users SET pcosto = :pcosto WHERE id = :id"); $query->bindParam("pcosto", $pcosto, PDO::PARAM_INT); $query->bindPar...
asked by 08.08.2017 / 20:06
1
answer

Error while traversing PHP associative array

Good afternoon, I have the following question: Why is not the value in the column I want to access displayed on the screen? I have this PHP code with which I verify the login of a user. public function verificarUsuario($nombre_usuario...
asked by 10.07.2017 / 22:38