Antetodo disculpa mi poca claridad en las respuestas pues no soy programador.
Lo que guarda en el campo "foto"de la tabla"fotos" es el nombre del archibo"ejemplo: moto.jpg es lo que se queda registrado en el campo "foto""
Respecto a tu pregunta, el campo "foto" queda perfectamente guardado el nombre del archobo "moto.jpg" cuando el usuario envia la foto.
Voy a ver si encuentro lo del codigo que me pides de la insercion del campo y la obtencion de datos.
Perdona pero no entiendo lo de la $row , estoy buscando por google la definicion y la aplicacion que tiene pero no encuentro nada asi que no se que es lo que necesitas... lo siento...
Primero hago esto para recoger la id del registro :
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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 fotos (nombre, usuario, lugarfoto, descripcion, foto) VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['usuario'], "text"),
GetSQLValueString($_POST['lugarfoto'], "text"),
GetSQLValueString($_POST['descripcion'], "text"),
GetSQLValueString($_POST['foto'], "text"));
mysql_select_db($database_mibase, $mibase);
$Result1 = mysql_query($insertSQL, $mibase) or die(mysql_error());
$id_ultimo = mysql_insert_id(); //recogemos la id del ultimo insert, el de arriba
$_SESSION['id'] = $id_ultimo; // guardamos la variable id en una variable de sesion asi al enviar la foto se guardara en la id registrada
$insertGoTo = "enviar-fotos-paso2_personal_restringido.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
El formulario a rellenar que se gurda en Base de datos es este:
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Nombre:</td>
<td><input name="nombre" type="text" onMouseOver="MM_showHideLayers('Layer8','','show') " value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Usuario:</td>
<td><input type="text" name="usuario" value="<?php echo $_SESSION['MM_Username']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Lugarfoto:</td>
<td><input type="text" name="lugarfoto" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Descripcion:</td>
<td><textarea name="descripcion" cols="32" rows="8"></textarea></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Enviar datos"></td>
</tr>
</table>
<input type="hidden" name="foto" value="">
<input type="hidden" name="MM_insert" value="form1">
</form>
La foto los usuarios la envian asi:
<form action="subir_archivo_personal-restringido.php" method="POST" enctype="multipart/form-data" name="form1">
<p align="center">
<input name="archivo" type="file" id="archivo" onMouseOver="MM_showHideLayers('Layer11','','show' );MM_showHideLayers('Layer11','','show')" value="" size="32" />
<input type="submit" name="Submit" value="Enviar" />
</p>
<div class="Estilo83" id="Layer11" onfocus="MM_showHideLayers('Layer11','','show')">< span class="Estilo85">Los nombres de los archivos deben constar de letras y numero tansolo.</span> <span class="Estilo73 Estilo84">El archibo o foto que vas a enviar no puede tener caracteres especiales ( no reconoce los signos "()!?¿_-&%$ entre otros, ) </span></div>
<p align="center"> </p>
<p align="center"> </p>
<p align="center">
<label></label>
</p>
<p align="center" class="Estilo79 Estilo40">
<input name="radiobutton" type="radio" value="radiobutton" checked>
<span class="Estilo86"><span class="Estilo87">Enviando la foto nos das permiso para que podamos publicar la imagen<em><strong> en nuestra web</strong></em></span>. </span></p>
<p align="center">
<label></label>
<label></label>
</p>
</form>
Asi recogo la $row_paginador:
mysql_select_db($database_mibase, $mibase);
$query_paginador = "SELECT * FROM fotos";
$paginador = mysql_query($query_paginador, $mibase) or die(mysql_error());
$row_paginador = mysql_fetch_assoc($paginador);
$totalRows_paginador = mysql_num_rows($paginador);
Alguna sugerencia ?