note 129880 added to ref.pdo-dblib

From: Date: Tue, 26 Nov 2024 14:13:40 +0000
Subject: note 129880 added to ref.pdo-dblib
Groups: php.notes 
Request: Send a blank email to php-notes+get-221681@lists.php.net to get a copy of this message
public function obtenerCorreo($correo) { try { $sql = 'SELECT correo FROM usuarios WHERE correo = :correo'; $stmt = $this->conexion->prepare($sql); $stmt->bindValue(':correo', $correo, PDO::PARAM_STR); $stmt->execute(); $usuario = $stmt->fetch(PDO::FETCH_ASSOC); // Verificar si se encontró el correo. if ($usuario) { return $usuario['correo']; } else { return "Correo no encontrado."; } } catch (PDOException $e) { echo "Error para obtener el correo: " . $e->getMessage(); return false; } } public function obtenerNombre($correo) { try { $sql = 'SELECT nombre FROM usuarios WHERE correo = :correo'; $stmt = $this->conexion->prepare($sql); $stmt->bindValue(':correo', $correo, PDO::PARAM_STR); $stmt->execute(); $usuario = $stmt->fetch(PDO::FETCH_ASSOC); // Verificar si se encontró el nombre. if ($usuario) { return $usuario['nombre']; } else { return "Nombre no encontrado."; } } catch (PDOException $e) { echo "Error para obtener el nombre: " . $e->getMessage(); return false; } } public function obtenerRol($correo) { try { $sql = 'SELECT rol FROM usuarios WHERE correo = :correo'; $stmt = $this->conexion->prepare($sql); $stmt->bindValue(':correo', $correo, PDO::PARAM_STR); $stmt->execute(); $usuario = $stmt->fetch(PDO::FETCH_ASSOC); // Verificar si se encontró el rol. if ($usuario) { return $usuario['rol']; } else { return "Rol no encontrado."; } } catch (PDOException $e) { echo "Error para obtener el rol: " . $e->getMessage(); return false; } } ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 31.4.134.44) ---- Manual Page -- https://php.net/manual/en/ref.pdo-dblib.php Edit -- https://main.php.net/note/edit/129880 Del: integrated -- https://main.php.net/note/delete/129880/integrated Del: useless -- https://main.php.net/note/delete/129880/useless Del: bad code -- https://main.php.net/note/delete/129880/bad+code Del: spam -- https://main.php.net/note/delete/129880/spam Del: non-english -- https://main.php.net/note/delete/129880/non-english Del: in docs -- https://main.php.net/note/delete/129880/in+docs Del: other reasons-- https://main.php.net/note/delete/129880 Reject -- https://main.php.net/note/reject/129880 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221681) next »