Ver Mensaje Individual
  #4 (permalink)  
Antiguo 10/08/2006, 14:35
climax2006
 
Fecha de Ingreso: abril-2006
Mensajes: 240
Antigüedad: 18 años
Puntos: 1
hola este es le codigo...
la primera comprobacion la hace ni un problema y la tercera(k es la ultima comprobacion ni un problema).. la segunda es la k guatea.... en la pegina anterior(paso1) ingreso los datos y le doy next y todo bien creas las tablas y la bdd.. pero cuando lo hago de nuevo(para repetir y me mande los errores correspondentes la unica k falla es la segunada comprobacion y me manda ala tercera"sale el error de tablas y no de k esta creada la bdd")
de antemasno gracias

Código PHP:
<?
$basedatos 
$_POST["bdd"];
//conectamos con el servidor
$link = @mysql_connect($_POST["host"],$_POST["usuariomysql"],$_POST["contrasenamysql"]);

// comprobamos que hemos estabecido conexión en el servidor
if (! $link){
?>
<script language="javascript" type="text/javascript">
  alert("No se ha podido establecer la coneccion con el servidor");
  window.location.href='<? $PHP_SELF?>?tipo=paso1';
</script>
<?
}
?>


<?
// obtenemos una lista de las bases de datos del servidor
$db mysql_list_dbs();

// vemos cuantas BD hay
$num_bd mysql_num_rows($db);

//comprobamos si la BD que quermos crear exite ya
$existe "NO" ;
for (
$i=0$i<$num_bd$i++) {
if (
mysql_dbname($db$i) == $basedatos) {
$existe "SI" ;
break;
}
}
 
// si no existe la creamos
if ($existe == "NO") {
 
/* creo la base de datos */
if (!mysql_query("CREATE DATABASE $basedatos"$link)){
?>
<script language="javascript" type="text/javascript">
  alert("No se ha podido crear la base de datos,\n por favor intente con otro nombre");
  window.location.href='<? echo $_SERVER['PHP_SELF']?>?tipo=paso1';
</script>
<?
  

 }
?>

<?
// craamos la tabla

$sql "CREATE TABLE agenda (";
$sql .= "id INT NOT NULL AUTO_INCREMENT, ";
$sql .= "nombre CHAR(50), ";
$sql .= "direccion CHAR(100), ";
$sql .= "telefono CHAR(15), ";
$sql .= "email CHAR(50), ";
$sql .= "KEY (id) ) ";

if (@
mysql_db_query($basedatos$sql$link)) {

echo 
"<form method='post' onsubmit='return valida(this)' action='".$PHP_SELF."?tipo=paso3'>";
echo 
"<table width='100%'>";
echo 
"<tr>";
echo 
"<td width='30%' rowspan='3'>";
echo 
"<table cellpadding='0' cellspacing='0' border='0'>";
echo 
"<tr>";
echo 
"<td width='166' class='step-off'>pre-instalacion</td>";
echo 
"<td width='57'></td>";
echo 
"</tr>";
echo 
"<tr>";
echo 
"<td height='3'></td>";
echo 
"<td rowspan='7' style='border-right-color:1px solid #cccccc'></td>";
echo 
"</tr>";
echo 
"<tr>";
echo 
"<td class='step-off'>licencia</td>";
echo 
"</tr>";
echo 
"<tr>";
echo 
"<td height='3'></td>";
echo 
"</tr>";
echo 
"<tr>";
echo 
"<td class='step-off'>paso 1</td>";
echo 
"</tr>";
echo 
"<tr>";
echo 
"<td height='3'></td>";
echo 
"</tr>";
echo 
"<tr>";
echo 
"<td class='step-on'>paso 2</td>";
echo 
"</tr>";
echo 
"<tr>";
echo 
"<td height='3'></td>";
echo 
"</tr>";
echo 
"<tr>";
echo 
"<td class='step-off'>paso 3</td>";
echo 
"</tr>";
echo 
"<tr>";
echo 
"<td height='3'></td>";
echo 
"</tr>";
echo 
"<tr>";
echo 
"<td class='step-off'>paso 4</td>";
echo 
"<td></td>";
echo 
"</tr>";
echo 
"</table>";
echo 
"</td>";
echo 
"<td width='51%' rowspan='2'>";
echo 
"<table width='100%'>";
echo 
"<tr>";
echo 
"<td><img src='img/install_logo.png'></td>";
echo 
"<td><h1>Paso 2</h1></td>";
echo 
"</tr>";
echo 
"</table>";
echo 
"</td>";
echo 
"<td width='19%' class='far-right'><input type='submit' value='siguiente >>' class='button'>";
echo 
"<br /><br />";
echo 
"</td>";
echo 
"</tr>";
echo 
"<tr>";
echo 
"<td></td>";
echo 
"</tr>";
echo 
"<tr>";
echo 
"<td class='installh1'>Ingresa el nombre de la aplicacion</td>";
echo 
"</tr>";
echo 
"</table>";
echo 
"<table width='100%'>";
echo 
"<tr>";
echo 
"<td width='30%'></td>";
echo 
"<td width='70%' class='form-block'>Nombre del Sitio: <input type='text' name='sitio' maxlength='20'><br><br>";
echo 
" El nombre de tu aplicaicion, este nombre es usado en un mensaje de mail alguna veces. ";
echo 
"</td></tr>";
echo 
"</table>";
echo 
"</form>";

} else {
?>
<script language="javascript" type="text/javascript">
  alert("No se ha podido crear las tablas, verifique los datos ingresados");
  window.location.href='<? $PHP_SELF?>?tipo=paso1';
</script>

<?
}
?>