Skip to content

Instantly share code, notes, and snippets.

@juque
Created March 21, 2011 13:16
Show Gist options
  • Select an option

  • Save juque/879435 to your computer and use it in GitHub Desktop.

Select an option

Save juque/879435 to your computer and use it in GitHub Desktop.
<?php
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
require_once 'Zend/Db.php';
$pdoParams = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8;');
$config = array(
'host' => 'localhost',
'username' => 'tipper_tipperbd',
'password' => 'tipperbd',
'dbname' => 'tipper_tipper',
'driver_options' => $pdoParams
);
$db = Zend_Db::factory('PDO_MYSQL',$config);
?>
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>z</title>
</head>
<body>
<?php
print_r($db->fetchAll('SELECT * FROM integrantes WHERE rut2_int = \'17083831\''));
?>
<form action="z.php" method="post">
<div>Paterno: <input type="text" name="apa_int" id="apa_int" /></div>
<div>Materno <input type="text" name="ama_int" id="ama_int" /></div>
<div>
<input type="submit" name="enviar" />
</div>
</form>
<?php
if ( isset($_POST['enviar']) )
{
$_sql = "update integrantes set apa_int = %s ,ama_int = %s where rut2_int = %s";
$sql = sprintf($_sql,
$db->quote($_POST['apa_int'],'STRING'),
$db->quote($_POST['ama_int'],'STRING'),
$db->quote('17083831')
);
$db->query($sql);
}
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment