note 129305 added to pdo.construct

From: Date: Sun, 03 Mar 2024 23:00:04 +0000
Subject: note 129305 added to pdo.construct
Groups: php.notes 
Request: Send a blank email to php-notes+get-221225@lists.php.net to get a copy of this message
<form action="prueba2.php" method="POST"> <label>si</label> <select name="estudiante" id="estudiante"> <?php $dsn = 'mysql:host=localhost'; $usuario = 'root'; $contraseña = ''; try { $conexion = new PDO($dsn, $usuario, $contraseña); $conexion->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $conexion->exec("USE escuela"); $consulta1 = "SELECT dni FROM estudiantes"; $resultado = $conexion->query($consulta1); while ($todo = $resultado->fetch()) { echo "<option value=", $todo['dni'], ">", $todo['dni'], "</option>"; } } catch (PDOException $e) { echo 'Falló la conexión: ' . $e->getMessage(); } ?> </select> <input type="submit" value="Enviar"> </form> ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.13.131 (proxied: 83.60.29.95) ---- Manual Page -- https://php.net/manual/en/pdo.construct.php Edit -- https://main.php.net/note/edit/129305 Del: integrated -- https://main.php.net/note/delete/129305/integrated Del: useless -- https://main.php.net/note/delete/129305/useless Del: bad code -- https://main.php.net/note/delete/129305/bad+code Del: spam -- https://main.php.net/note/delete/129305/spam Del: non-english -- https://main.php.net/note/delete/129305/non-english Del: in docs -- https://main.php.net/note/delete/129305/in+docs Del: other reasons-- https://main.php.net/note/delete/129305 Reject -- https://main.php.net/note/reject/129305 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221225) next »