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...
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...
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...
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...
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...
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,...
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...
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 {...
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...
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...