He trabajo muy bien con el Dreamweaver pero hasta ahora con operaciones básicas, ahora debo primero entender un poco de las funciones que crea dicho programa para modificar el codigo de modo que pueda adaptarlo para hacer que también me suba una imagen a mi campo correspondiente...
Código PHP:
<?php
//INICIO DEL DOLOR DE CABEZA -------------------------------------------------------------------------
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"] == "enviar")) {
$insertSQL = sprintf("INSERT INTO prueba01 (id_prueba1, dato_prueba1, imagen1) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['id_prueba1'], "int"),
GetSQLValueString($_POST['dato_prueba1'], "text"),
GetSQLValueString($_POST['form_imagen1'], "text"));
mysql_select_db($database_gcd, $gcd);
$Result1 = mysql_query($insertSQL, $gcd) or die(mysql_error());
}
// FIN DEL DOLOR DE CABEZA ---------------------------------------------------------------------------
// Como Adapto este formulario para que suba imágenes??
// (INICIO) CONSULTA DE MAXIMOS IDS----------------------------------------------------------------------
mysql_select_db($database_gcd, $gcd);
$query_maximos1y2 = "SELECT max(id_prueba1), max(id_prueba2) FROM prueba01, prueba02";
$maximos1y2 = mysql_query($query_maximos1y2, $gcd) or die(mysql_error());
$row_maximos1y2 = mysql_fetch_assoc($maximos1y2);
$totalRows_maximos1y2 = mysql_num_rows($maximos1y2);
// (FIN) CONSULTA DE MAXIMOS IDS --------------------------------------------------------------------------?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Documento sin título</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<? //Formulario a utilizar!! ?>
<body>
<form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="enviar" id="enviar"POST>
<p>Dato en tabla01
<input name="dato_prueba1" type="text" id="dato_prueba1" size="10" maxlength="10">
<input name="id_prueba1" type="hidden" id="id_prueba1" value="<?php echo $row_maximos1y2['max(id_prueba1)']; ?>">
</p>
<p>Dato en tabla02
<input name="dato_prueba2" type="text" id="dato_prueba2" size="10" maxlength="10">
<input name="id_prueba2" type="hidden" id="id_prueba2" value="<?php echo $row_maximos1y2['max(id_prueba2)']; ?>">
</p>
<p>Imagen:
<input name="form_imagen1" type="file" id="form_imagen1">
</p>
<p> </p>
<p>
<input name="Submit_enviar" type="submit" id="Submit_enviar" value="Enviar">
</p>
<input type="hidden" name="MM_insert" value="enviar">
</form>
</body>
</html>
<?php
mysql_free_result($maximos1y2);
?>
No crean que soy un vago!, aquí tengo mis libritos de PHP/MySQL y un chorro de Tutoriales con Scripts, pero aún así no logro hacer esto de las imágenes y lo peor es que todo el mundo lo hace fácil!!!
Claro la diferencia es que yo quiero adaptar el código de Dreamweaver jejeje!
Espero Ayudar algún día Por ahora solo soy bueno en...
AutoCAD, 3D Studio MAX,Photoshop y me defiendo con el Flash!!!
Ah! Keleriano gracias por atender mi mensaje!!
...es que llevo a penas un mes con esto del PHP/MySQL
Bye!