Ver Mensaje Individual
  #3 (permalink)  
Antiguo 28/12/2006, 15:04
Jarkaos
 
Fecha de Ingreso: noviembre-2002
Ubicación: Suecia
Mensajes: 253
Antigüedad: 21 años, 5 meses
Puntos: 2
Re: Problema con Base de datos

el explorador no da ningun error solo me devuelve a la pagina de inicio.
y este el el codigo que estoy usando:

<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO usuarios (usuario, password, nombre, apellido, email) VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($_POST['usuario'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['apellido'], "text"),
GetSQLValueString($_POST['email'], "text"));

mysql_select_db($database_foto, $foto);
$Result1 = mysql_query($insertSQL, $foto) or die(mysql_error());

$insertGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>

Debo reconocer que esta hecho con dreamweaver por lo que seguramente habran cosas que estan de mas. Pero me funciona de un u otra forma jejeje