Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/04/2009, 11:23
Avatar de julita_punch
julita_punch
 
Fecha de Ingreso: abril-2007
Ubicación: Lima - Peru
Mensajes: 505
Antigüedad: 17 años
Puntos: 4
No database selected

buenos dias amigos colisteros
estoy probando con una base de datos demo
para insertar registros pero a la hora de subirlos me sale el mensaje de No database selected
agradeceria me pudiesen ayudar a resolver mi problema
por cierto
este es el codigo

<?php
$state = false;
if ($_POST['action'] == "add") {
$conexion = mysql_connect("localhost", "mihueb_julita", "ninguna");
mysql_select_db("mihueb_demo", $conexion);

$que = "INSERT INTO empresa (nombre, direccion, telefono) ";
$que.= "VALUES ('".$_POST['nombre']."', '".$_POST['dir']."', '".$_POST['fono']."') ";
$res = mysql_query($que, $conexion) or die(mysql_error());
$state = true;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Insertar datos en MySQL</title>
<style type="text/css">
<!--
body {
font-family: "Trebuchet MS", Tahoma, Arial;
font-size: 12px;
color: #333333;
}
h2 {
font-size: 16px;
color: #CC0000;
}
input, select {
font-family: "Trebuchet MS", Tahoma, Arial;
font-size: 11px;
color: #666666;
}
-->
</style>
</head>
<body>
<h2>Insertar datos en MySQL</h2>
<form id="insertar" name="insertar" method="post" action="">
<p>Nombre:
<input name="nombre" type="text" id="nombre" size="50" />
</p>
<p>Direccion:
<input name="dir" type="text" id="dir" size="50" />
</p>
<p>Telefono:
<input name="fono" type="text" id="fono" size="50" />
</p>
<input type="submit" name="Submit" value="Insertar Registro" />
<input type="hidden" name="action" value="add" />
</form>
<?php if ($state) { ?>
<p><em>Registro insertado correctamente</em></p>
<?php } ?>
</body>
</html>