Foros del Web » Programando para Internet » PHP »

Problemas con la fecha

Estas en el tema de Problemas con la fecha en el foro de PHP en Foros del Web. Estimados amigos. Tengo una tabla cuyos datos se completan desde un formulario. En la tabla tengo un campo que se llama FECHA con el tipo ...
  #1 (permalink)  
Antiguo 01/10/2008, 04:42
 
Fecha de Ingreso: septiembre-2007
Mensajes: 50
Antigüedad: 16 años, 6 meses
Puntos: 0
Problemas con la fecha

Estimados amigos.

Tengo una tabla cuyos datos se completan desde un formulario.
En la tabla tengo un campo que se llama FECHA con el tipo DATE

Quiero que al cargar los datos de ese cliente me figure la fecha en la que ha rellenado el formulario de la forma 15 – 05 – 08 (día, mes, año).

En estos momentos al cargar la página con los datos de cualquier cliente, en la fecha sólo me salen ceros y de esta forma: 0000 – 00 – 00 (año, mes, día).

Así que lo que quiero es que se actualize la fecha (figure la fecha de entrada de datos) y cambiar el formato actual.

Espero vuestras respuestas.


Saludos.
  #2 (permalink)  
Antiguo 01/10/2008, 04:49
Avatar de jaronu  
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 16 años, 2 meses
Puntos: 52
Respuesta: Problemas con la fecha

hola

como tienes el codigo??

el orden año mes dia

se puede cambiar usando la funcion explode();
  #3 (permalink)  
Antiguo 02/10/2008, 01:10
 
Fecha de Ingreso: septiembre-2007
Mensajes: 50
Antigüedad: 16 años, 6 meses
Puntos: 0
Respuesta: Problemas con la fecha

Hola Jaronu.

He cambiado el códgo y ahora me sale la fecha actual (del día que se ve) en cada cliente y lo que quiero es que me salga la fecha del día que rellenó el formulario y por lo tanto ingresó sus datos en la base de datos.

Envío el código:

<?php require_once('Connections/conexionconsultas.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];

$maxRows_ver = 20;
$pageNum_ver = 0;
if (isset($_GET['pageNum_ver'])) {
$pageNum_ver = $_GET['pageNum_ver'];
}
$startRow_ver = $pageNum_ver * $maxRows_ver;

mysql_select_db($database_conexionconsultas, $conexionconsultas);
$query_ver = "SELECT * FROM `general`";
$query_limit_ver = sprintf("%s LIMIT %d, %d", $query_ver, $startRow_ver, $maxRows_ver);
$ver = mysql_query($query_limit_ver, $conexionconsultas) or die(mysql_error());
$row_ver = mysql_fetch_assoc($ver);

if (isset($_GET['totalRows_ver'])) {
$totalRows_ver = $_GET['totalRows_ver'];
} else {
$all_ver = mysql_query($query_ver);
$totalRows_ver = mysql_num_rows($all_ver);
}
$totalPages_ver = ceil($totalRows_ver/$maxRows_ver)-1;

$queryString_ver = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_ver") == false &&
stristr($param, "totalRows_ver") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_ver = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_ver = sprintf("&totalRows_ver=%d%s", $totalRows_ver, $queryString_ver);
?><!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>Documento sin t&iacute;tulo</title>
</head>

<body>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="760" align="center">
<tr>
<th width="120" scope="col">fecha</th>
<th width="333" scope="col">reforma</th>
<th width="181" scope="col">localidad</th>
<th width="106" scope="col">provincia</th>
</tr>
<?php do { ?>

<tr>

<td><?php echo date("d-m-y");?></td>
<td><a href="datos_cliente.php?Id=<?php echo $row_ver['Id']; ?>"><?php echo $row_ver['reforma']; ?></a></td>
<td><a href="datos_cliente.php?Id=<?php echo $row_ver['Id']; ?>"><?php echo $row_ver['Localidad']; ?></a></td>
<td><a href="datos_cliente.php?Id=<?php echo $row_ver['Id']; ?>"><?php echo $row_ver['Provincia']; ?></a></td>
</tr>
<?php } while ($row_ver = mysql_fetch_assoc($ver)); ?>
</table>
<br />
<table width="760">
<tr>
<td width="78"><?php if ($pageNum_ver > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_ver=%d%s", $currentPage, max(0, $pageNum_ver - 1), $queryString_ver); ?>">Anterior</a>
<?php } // Show if not first page ?> </td>
<td width="589">&nbsp;</td>
<td width="77"><?php if ($pageNum_ver < $totalPages_ver) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_ver=%d%s", $currentPage, min($totalPages_ver, $pageNum_ver + 1), $queryString_ver); ?>">Siguiente</a>
<?php } // Show if not last page ?> </td>
</tr>
</table>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($ver);
?>
  #4 (permalink)  
Antiguo 02/10/2008, 01:47
Avatar de jaronu  
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 16 años, 2 meses
Puntos: 52
Respuesta: Problemas con la fecha

te sale la fecha actual y no la fecha que ingreso los datos en la base porque lo estas haciendo asi en esta linea

<td><?php echo date("d-m-y");?></td> esto es la fecha actual y no la que tienes en la base

en la consulta has de obtener tambien la fecha del dia del form, has de hacer un INSERT en la bbdd de la fecha
  #5 (permalink)  
Antiguo 02/10/2008, 11:13
 
Fecha de Ingreso: septiembre-2007
Mensajes: 50
Antigüedad: 16 años, 6 meses
Puntos: 0
Respuesta: Problemas con la fecha

Estimado Jaronu.

No tengo ni idea de PHP.
Si puedes detallarme los pasos para hacer un INSERT de la fecha en la base de datos te lo agradecería.


Saludos cordiales.
  #6 (permalink)  
Antiguo 02/10/2008, 11:51
Avatar de jaronu  
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 16 años, 2 meses
Puntos: 52
Respuesta: Problemas con la fecha

deacuerdo, pero postea el codigo con el que insertas los datos en la base

pero seria una cosa asi mas o menos

Código PHP:
$query 'INSERT INTO tabla ( fecha)
                VALUES (\''
.date("Y-m-d").'\')';
                
mysql_query($query) or die(mysql_error());
                echo 
'fecha insertada!'
  #7 (permalink)  
Antiguo 06/10/2008, 12:09
 
Fecha de Ingreso: septiembre-2007
Mensajes: 50
Antigüedad: 16 años, 6 meses
Puntos: 0
Respuesta: Problemas con la fecha

Estimado Jaronu.

Estoy seguro que tú respuesta es válida, lo malo es que o soy bastante novato en esto y no tengo ni idea de PHP ni SQL.

Manejo la base de datos desde PHPMyAdmin y el resto lo hago con Dreamweaver y de código no tengo ni idea.

Tengo el problema que no sé ni como entrar al código de la base de datos, así que no puedo hacer lo que me dices.

Me ha comentado una persona que igual se puede hacer algo desde la página del formulario que envía los datos a la base de datos, para que incluya la fecha del envío del formulario y quede reflejada en la base de datos.

Como datos te puedo decir que la TABLA se llama general

Tiene un campo que se llama fecha con el tipo DATE, que es el campo dónde debe incluirse la fecha del formulario.

La fecha la quiero en formato día(00) - mes(00) - año(0000)

El código de la página del formulario es:


<?php require_once('Connections/conexionreformas.php'); ?>
<?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 general (`Nombre_ y _Apellidos`, Dirección, Teléfono, Email, `Plazo_ de_ inicio`, Localidad, Provincia, `Código_ postal`, Descripción, reforma) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Nombre_y_Apellidos'], "text"),
GetSQLValueString($_POST['Direccin'], "text"),
GetSQLValueString($_POST['Telfono'], "text"),
GetSQLValueString($_POST['Email'], "text"),
GetSQLValueString($_POST['Plazo_de_inicio'], "text"),
GetSQLValueString($_POST['Localidad'], "text"),
GetSQLValueString($_POST['Provincia'], "text"),
GetSQLValueString($_POST['Cdigo_postal'], "text"),
GetSQLValueString($_POST['Descripcin'], "text"),
GetSQLValueString($_POST['obra_realizar'], "text"));

mysql_select_db($database_conexionreformas, $conexionreformas);
$Result1 = mysql_query($insertSQL, $conexionreformas) or die(mysql_error());
$insertGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?><!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>Documento sin t&iacute;tulo</title>
</head>

<body>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td width="232" align="right" nowrap>Nombre y Apellidos:</td>
<td> <div align="center">
<input type="text" name="Nombre_y_Apellidos" value="" size="40" />
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Dirección:</td>
<td> <div align="center">
<input type="text" name="Direccin" value="" size="40">
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Teléfono:</td>
<td> <div align="center">
<input type="text" name="Telfono" value="" size="40">
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Email:</td>
<td> <div align="center">
<input type="text" name="Email" value="" size="40">
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Inicio de la obra:</td>
<td><div align="center">
<input type="text" name="Plazo_de_inicio" value="" size="40" />
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Localidad de la obra:</td>
<td> <div align="center">
<input type="text" name="Localidad" value="" size="40">
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Provincia de la obra:</td>
<td><div align="center">
<input type="text" name="Provincia" value="" size="40" />
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Código postal:</td>
<td><div align="center">
<input type="text" name="Cdigo_postal" value="" size="40" />
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Obra a realizar:<br />
(Ej: Reformar piso) </td>
<td><div align="center">
<input name="obra_realizar" type="text" id="obra_realizar" value="" size="40" />
</div></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap>Descripci&oacute;n de la obra: </td>
<td><label>
<div align="center">
<textarea name="Descripcin" cols="34" rows="5" id="Descripcin"></textarea>
</div>
</label></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">&nbsp;</td>
<td><input name="submit" type="submit" value="Enviar" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p>&nbsp;</p>
</body>
</html>



Si sabes el código que debo colocar y el lugar exacto dónde hacerlo, te lo agradecería un montón.

Saludos cordiales.
  #8 (permalink)  
Antiguo 06/10/2008, 12:32
Avatar de jaronu  
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 16 años, 2 meses
Puntos: 52
Respuesta: Problemas con la fecha

OK te hecho una mano, no hay problema por eso, pero que sepas, por lo menos es lo que yo se, en MySQL la fecha la has de insertar en formato americano año mes dia y despues con el codigo le das la vuelta

ahora te reviso el codigo
  #9 (permalink)  
Antiguo 06/10/2008, 12:49
Avatar de jaronu  
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 16 años, 2 meses
Puntos: 52
Respuesta: Problemas con la fecha

te revise el code y a si podras insertar en la base la fecha en formato de MySQL año mes dia

Código PHP:


<?php require_once('Connections/conexionreformas.php'); ?>
<?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 general (`Nombre_ y _Apellidos`, Dirección, Teléfono, Email, `Plazo_ de_ inicio`, Localidad, Provincia, `Código_ postal`, Descripción, reforma) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Nombre_y_Apellidos'], "text"),
GetSQLValueString($_POST['Direccin'], "text"),
GetSQLValueString($_POST['Telfono'], "text"),
GetSQLValueString($_POST['Email'], "text"),
GetSQLValueString($_POST['Plazo_de_inicio'], "text"),
GetSQLValueString($_POST['Localidad'], "text"),
GetSQLValueString($_POST['Provincia'], "text"),
GetSQLValueString($_POST['Cdigo_postal'], "text"),
GetSQLValueString($_POST['Descripcin'], "text"),
GetSQLValueString($_POST['obra_realizar'], "text"));

mysql_select_db($database_conexionreformas$conexionreformas);
$Result1 mysql_query($insertSQL$conexionreformas) or die(mysql_error());
$insertGoTo "index.php";
if (isset(
$_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s"$insertGoTo));
}
?><!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>Documento sin t&iacute;tulo</title>
</head>

<body>
<form method="post" name="form1" action="<?php echo $editFormAction?>">
<table align="center">
<tr valign="baseline">
<td width="232" align="right" nowrap>Nombre y Apellidos:</td>
<td> <div align="center">
<input type="text" name="Nombre_y_Apellidos" value="" size="40" /> 
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Dirección:</td>
<td> <div align="center">
<input type="text" name="Direccin" value="" size="40"> 
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Teléfono:</td>
<td> <div align="center">
<input type="text" name="Telfono" value="" size="40"> 
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Email:</td>
<td> <div align="center">
<input type="text" name="Email" value="" size="40"> 
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Inicio de la obra:</td>
<td><div align="center">
<input type="text" name="Plazo_de_inicio" value=" <?php echo date("Y-m-d"); ?> " size="40" />
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Localidad de la obra:</td>
<td> <div align="center">
<input type="text" name="Localidad" value="" size="40"> 
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Provincia de la obra:</td>
<td><div align="center">
<input type="text" name="Provincia" value="" size="40" />
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Código postal:</td>
<td><div align="center">
<input type="text" name="Cdigo_postal" value="" size="40" />
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Obra a realizar:<br />
(Ej: Reformar piso) </td>
<td><div align="center">
<input name="obra_realizar" type="text" id="obra_realizar" value="" size="40" />
</div></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap>Descripci&oacute;n de la obra: </td>
<td><label>
<div align="center">
<textarea name="Descripcin" cols="34" rows="5" id="Descripcin"></textarea>
</div>
</label></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">&nbsp;</td>
<td><input name="submit" type="submit" value="Enviar" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p>&nbsp;</p>
</body>
</html>
ahora para tu ver los datos tendras otro codigo que no enseñas, pero en el deberias incluir este trozo de codigo que te muestra la fecha en el formato que tu quieres:

Código PHP:

$fecha 
explode ("-",$row[fecha]);

echo 
$fecha[2]."-".$fecha[1]."-".$fecha[0]; 
si posteas el codigo donde haces la consulta ala base y no el insertar los datos que es el code que has posteado te dire donde lo tienes que poner

suerte y al toro que se dice aqui
  #10 (permalink)  
Antiguo 07/10/2008, 06:38
 
Fecha de Ingreso: septiembre-2007
Mensajes: 50
Antigüedad: 16 años, 6 meses
Puntos: 0
Respuesta: Problemas con la fecha

Estimado Jaronu.

Siento molestarte y te agradezco que te tomes tanto interés por resolver mi problema.

Para que veas un ejemplo de lo que quiero es una página del tipo de:
http://www.instalareforma.com/ultpre.php

En la que las fechas que aparecen son las del día en que se ha enviado el formulario.

Con la solución que tú me has dado el formulario me queda:

Nombre y Apellidos:
Dirección
Teléfono:
Email:
Inicio de la obra: 2008-10-07
Localidad de la obra:
Provincia de la obra:
Código Postal:
Obra a realizar:
(Ej:Reformar piso)
Descripción de la obra:

En la casilla de inicio de la obra se me pone directamente la fecha de hoy y eso no es lo que quiero.
Las casillas del formulario deben quedar todas vacías.
Las debe rellenar la persona que quiere realizar la obra, esos datos van a una tabla de mi base de datos de nombre: general
Esa tabla tiene un campo que se llama fecha que no se rellena con ningún dato de los que ha puesto la persona que rellena el formulario, sino que en ese campo debe aparecer la fecha del día en que se ha rellenado el formulario y en el formato español día-mes-año como aparece en la página que te indicaba de ejemplo.

Te envío, según me pides, el código de la página que hace la consulta a la base de datos (en la que debe figurar la fecha que tanta guerra nos da)


<?php require_once('Connections/conexionconsultas.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];

$maxRows_ver = 20;
$pageNum_ver = 0;
if (isset($_GET['pageNum_ver'])) {
$pageNum_ver = $_GET['pageNum_ver'];
}
$startRow_ver = $pageNum_ver * $maxRows_ver;

mysql_select_db($database_conexionconsultas, $conexionconsultas);
$query_ver = "SELECT * FROM `general`";
$query_limit_ver = sprintf("%s LIMIT %d, %d", $query_ver, $startRow_ver, $maxRows_ver);
$ver = mysql_query($query_limit_ver, $conexionconsultas) or die(mysql_error());
$row_ver = mysql_fetch_assoc($ver);

if (isset($_GET['totalRows_ver'])) {
$totalRows_ver = $_GET['totalRows_ver'];
} else {
$all_ver = mysql_query($query_ver);
$totalRows_ver = mysql_num_rows($all_ver);
}
$totalPages_ver = ceil($totalRows_ver/$maxRows_ver)-1;

$queryString_ver = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_ver") == false &&
stristr($param, "totalRows_ver") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_ver = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_ver = sprintf("&totalRows_ver=%d%s", $totalRows_ver, $queryString_ver);
?><!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>Documento sin t&iacute;tulo</title>
</head>

<body>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="760" align="center">
<tr>
<th width="120" scope="col">fecha</th>
<th width="333" scope="col">reforma</th>
<th width="181" scope="col">localidad</th>
<th width="106" scope="col">provincia</th>
</tr>
<?php do { ?>

<tr>

<td><div align="center"><?php echo $row_ver['Fecha']; ?></div></td>

<td><div align="center"><a href="datos_cliente.php?Id=<?php echo $row_ver['Id']; ?>" target="_blank"><?php echo $row_ver['reforma']; ?></a></div></td>
<td><div align="center"><a href="datos_cliente.php?Id=<?php echo $row_ver['Id']; ?>" target="_blank"><?php echo $row_ver['Localidad']; ?></a></div></td>
<td><div align="center"><a href="datos_cliente.php?Id=<?php echo $row_ver['Id']; ?>" target="_blank"><?php echo $row_ver['Provincia']; ?></a></div></td>
</tr>
<?php } while ($row_ver = mysql_fetch_assoc($ver)); ?>
</table>
<br />
<table width="760">
<tr>
<td width="78"><?php if ($pageNum_ver > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_ver=%d%s", $currentPage, max(0, $pageNum_ver - 1), $queryString_ver); ?>" target="_blank">Anterior</a>
<?php } // Show if not first page ?> </td>
<td width="589">&nbsp;</td>
<td width="77"><?php if ($pageNum_ver < $totalPages_ver) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_ver=%d%s", $currentPage, min($totalPages_ver, $pageNum_ver + 1), $queryString_ver); ?>" target="_blank">Siguiente</a>
<?php } // Show if not last page ?> </td>
</tr>
</table>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($ver);
?>





Saludos
  #11 (permalink)  
Antiguo 08/10/2008, 09:50
 
Fecha de Ingreso: septiembre-2007
Mensajes: 50
Antigüedad: 16 años, 6 meses
Puntos: 0
Respuesta: Problemas con la fecha

Estimados amigos.

No doy con la solución a mi problema, a pesar de las posibles soluciones que me habéis aportado (sobre todo jaronu) pero sigue sin funcionar.

He pensado en una solución, pero no sé si será posible.

El campo Fecha de mi tabla ahora es tipo: DATE, cambiarle al tipo: TIMESTAMP con valor predeterminado CURRENT_TIMESTAMP con lo que consigo que la tabla tome la fecha junto con la hora en la que se envió el formulario.

Sólo quiero que en la página que recupera los datos de la base de datos en el apartado de la fecha me recupere la fecha en formato: día-mes-año en ese orden.

Algo comentó sobre eso Jaronu, pero lo he probado y no funciona, igual es que lo coloco en un sitio distinto al que debe ir.

Si sabéis un código correcto para recuperar la fecha en formato español, os agadecería mucho que me lo comentéis y también el lugar dónde colocarlo, para ello os envío el código de la página que recupera los datos de la tabla:


<?php require_once('Connections/conexionconsultas.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];

$maxRows_ver = 20;
$pageNum_ver = 0;
if (isset($_GET['pageNum_ver'])) {
$pageNum_ver = $_GET['pageNum_ver'];
}
$startRow_ver = $pageNum_ver * $maxRows_ver;

mysql_select_db($database_conexionconsultas, $conexionconsultas);
$query_ver = "SELECT * FROM `general`";
$query_limit_ver = sprintf("%s LIMIT %d, %d", $query_ver, $startRow_ver, $maxRows_ver);
$ver = mysql_query($query_limit_ver, $conexionconsultas) or die(mysql_error());
$row_ver = mysql_fetch_assoc($ver);

if (isset($_GET['totalRows_ver'])) {
$totalRows_ver = $_GET['totalRows_ver'];
} else {
$all_ver = mysql_query($query_ver);
$totalRows_ver = mysql_num_rows($all_ver);
}
$totalPages_ver = ceil($totalRows_ver/$maxRows_ver)-1;

$queryString_ver = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_ver") == false &&
stristr($param, "totalRows_ver") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_ver = "&" . htmlentities(implode("&", $newParams));
}
}

$queryString_ver = sprintf("&totalRows_ver=%d%s", $totalRows_ver, $queryString_ver);

?><!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>Documento sin t&iacute;tulo</title>
</head>

<body>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="760" align="center">
<tr>
<th width="120" scope="col">fecha</th>
<th width="333" scope="col">reforma</th>
<th width="181" scope="col">localidad</th>
<th width="106" scope="col">provincia</th>
</tr>
<?php do { ?>

<tr>

<td><div align="center"><?php echo $row_ver['Fecha']; ?></div></td>

<td><div align="center"><a href="datos_cliente.php?Id=<?php echo $row_ver['Id']; ?>" target="_blank"><?php echo $row_ver['reforma']; ?></a></div></td>
<td><div align="center"><a href="datos_cliente.php?Id=<?php echo $row_ver['Id']; ?>" target="_blank"><?php echo $row_ver['Localidad']; ?></a></div></td>
<td><div align="center"><a href="datos_cliente.php?Id=<?php echo $row_ver['Id']; ?>" target="_blank"><?php echo $row_ver['Provincia']; ?></a></div></td>
</tr>
<?php } while ($row_ver = mysql_fetch_assoc($ver)); ?>
</table>
<br />
<table width="760">
<tr>
<td width="78"><?php if ($pageNum_ver > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_ver=%d%s", $currentPage, max(0, $pageNum_ver - 1), $queryString_ver); ?>" target="_blank">Anterior</a>
<?php } // Show if not first page ?> </td>
<td width="589">&nbsp;</td>
<td width="77"><?php if ($pageNum_ver < $totalPages_ver) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_ver=%d%s", $currentPage, min($totalPages_ver, $pageNum_ver + 1), $queryString_ver); ?>" target="_blank">Siguiente</a>
<?php } // Show if not last page ?> </td>
</tr>
</table>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($ver);
?>


Saludos cordiales.
  #12 (permalink)  
Antiguo 08/10/2008, 10:12
Avatar de Carlojas  
Fecha de Ingreso: junio-2007
Ubicación: Shikasta
Mensajes: 1.272
Antigüedad: 16 años, 10 meses
Puntos: 49
Respuesta: Problemas con la fecha

Que tal adibu, la solución que te dio jaronu debería funcionarte la probaste?obviamente con el valor rescatado de tu consulta, deja el campo de tu tabla tipo DATE
Código PHP:
<?php$fecha explode("-"$row_ver['Fecha']); 
$nfecha =  $fecha[2]."-".$fecha[1]."-".$fecha[0];
// Donde iría la fecha con el nuevo formato dentro de ciclo do While ?>
<td><div align="center"><?php echo $nfecha?></div></td>
Ahora si dices que no te funciona de esta forma puedes formatear la fecha directamente desde tu consuta utilizando la función MySQL DATE_FORMAT()
Código PHP:
$query_ver "SELECT *, DATE_FORMAT(Fecha, '%d-%m-%Y') AS Nfecha FROM `general`";
$query_limit_ver sprintf("%s LIMIT %d, %d"$query_ver$startRow_ver$maxRows_ver);
$ver mysql_query($query_limit_ver$conexionconsultas) or die(mysql_error());
$row_ver mysql_fetch_assoc($ver);
// Accedes al valor del array con la fecha ya formateada
echo $row_ver['Nfecha']; 

Saludos.
__________________
"SELECT * FROM Mujeres WHERE situacion NOT IN ('CASADAS','CON HIJOS','ATORMENTADAS','CUASI-ENNOVIADAS') AND personalidad <> 'INTENSA'"
  #13 (permalink)  
Antiguo 09/10/2008, 08:57
 
Fecha de Ingreso: septiembre-2007
Mensajes: 50
Antigüedad: 16 años, 6 meses
Puntos: 0
Respuesta: Problemas con la fecha

Estimados compañeros.

Voy consiguiendo cosas pero seguro que hay errores en el código y no acaba de funcionar.

Con el código que facilitó JARONU:
$query = 'INSERT INTO tabla ( fecha)
VALUES (\''.date("Y-m-d").'\')';
mysql_query($query) or die(mysql_error());
echo 'fecha insertada!';

He conseguido que al enviar el formulario se inserte la fecha de envío en el campo Fecha de la tabla general, pero al hacer un envío del formulario, en la tabla se me hacen dos ingresos:
- Uno que contiene los datos incluidos en el formulario con fecha 0000-00-00
- Otro en el que sólo figura la fecha de envío 2008-10-09 y los demás campos de la tabla están vacíos.

Igual he situado mal el código o hay algún otro error, pero sólo me ha ocurrido desde que inserté el código. Para ello os envío el código del formulario y ya me comentáis algo:

<?php require_once('Connections/conexionreformas.php'); ?>
<?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 general (`Nombre_ y _Apellidos`, Dirección, Teléfono, Email, `Plazo_ de_ inicio`, Localidad, Provincia, `Código_ postal`, Descripción, reforma) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Nombre_y_Apellidos'], "text"),
GetSQLValueString($_POST['Direccin'], "text"),
GetSQLValueString($_POST['Telfono'], "text"),
GetSQLValueString($_POST['Email'], "text"),
GetSQLValueString($_POST['Plazo_de_inicio'], "text"),
GetSQLValueString($_POST['Localidad'], "text"),
GetSQLValueString($_POST['Provincia'], "text"),
GetSQLValueString($_POST['Cdigo_postal'], "text"),
GetSQLValueString($_POST['Descripcin'], "text"),
GetSQLValueString($_POST['obra_realizar'], "text"));

mysql_select_db($database_conexionreformas, $conexionreformas);
$Result1 = mysql_query($insertSQL, $conexionreformas) or die(mysql_error()); $query = 'INSERT INTO general ( fecha)
VALUES (\''.date("Y-m-d").'\')';
mysql_query($query) or die(mysql_error());
echo 'fecha insertada!';
$insertGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}

?><!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>Documento sin t&iacute;tulo</title>
</head>

<body>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td width="232" align="right" nowrap>Nombre y Apellidos:</td>
<td> <div align="center">
<input type="text" name="Nombre_y_Apellidos" value="" size="40" />
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Dirección:</td>
<td> <div align="center">
<input type="text" name="Direccin" value="" size="40">
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Teléfono:</td>
<td> <div align="center">
<input type="text" name="Telfono" value="" size="40">
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Email:</td>
<td> <div align="center">
<input type="text" name="Email" value="" size="40">
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Inicio de la obra:</td>
<td><div align="center">
<input type="text" name="Plazo_de_inicio" value="" size="40" />
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Localidad de la obra:</td>
<td> <div align="center">
<input type="text" name="Localidad" value="" size="40">
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Provincia de la obra:</td>
<td><div align="center">
<input type="text" name="Provincia" value="" size="40" />
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Código postal:</td>
<td><div align="center">
<input type="text" name="Cdigo_postal" value="" size="40" />
</div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Obra a realizar:<br />
(Ej: Reformar piso) </td>
<td><div align="center">
<input name="obra_realizar" type="text" id="obra_realizar" value="" size="40" />
</div></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap>Descripci&oacute;n de la obra: </td>
<td><label>
<div align="center">
<textarea name="Descripcin" cols="34" rows="5" id="Descripcin"></textarea>
</div>
</label></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">&nbsp;</td>
<td><input name="submit" type="submit" value="Enviar" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p>&nbsp;</p>
</body>
</html>
  #14 (permalink)  
Antiguo 09/10/2008, 09:25
Avatar de jaronu  
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 16 años, 2 meses
Puntos: 52
Respuesta: Problemas con la fecha

Claro, estas haciendo dos INSERT a la BBDD

quita esto:
Código PHP:
mysql_select_db($database_conexionreformas$conexionreformas);
$Result1 mysql_query($insertSQL$conexionreformas) or die(mysql_error()); $query 'INSERT INTO general ( fecha) 
VALUES (\''
.date("Y-m-d").'\')'
mysql_query($query) or die(mysql_error()); 
echo 
'fecha insertada!'
que fue un ejemplo que te di, y en el campo del form del inicio de la obra pon esto:
Código PHP:
<input type="text" name="Plazo_de_inicio" value="<?php echo date("Y-m-d"); ?>" size="40" />
que creo que es lo que tu quieres, que en el campo del form del inicio de la obra aparezca la fecha de hoy
y el campo de la bbdd plazo_de_inicio sea del tipo DATE
Un saludo
  #15 (permalink)  
Antiguo 09/10/2008, 11:05
 
Fecha de Ingreso: septiembre-2007
Mensajes: 50
Antigüedad: 16 años, 6 meses
Puntos: 0
Respuesta: Problemas con la fecha

He hecho lo que me dices que elimine, Jaronu y la tabla no recibe los datos enviados por el formulario, aunque el formulario no da error .

He tenido que volver a poner en el formulario parte del código que me decías que quitara:
He dejado:

mysql_select_db($database_conexionreformas, $conexionreformas);
$Result1 = mysql_query($insertSQL, $conexionreformas) or die(mysql_error());

He quitado:

$query = 'INSERT INTO general ( fecha)
VALUES (\''.date("Y-m-d").'\')';
mysql_query($query) or die(mysql_error());
echo 'fecha insertada!';


Con esto la tabla recibe los datos pero la fecha es 0000-00-00 es decir, que la fecha del formulario no se incluye


En lo que respecta a tu segunda parte, me entendiste mal y no es lo quiero.

Quiero que inicio de la obra sea un campo normal del formulario y lo rellene el cliente por lo tanto no debe aparecer nada en él.
Y el campo de la tabla plazo_de_inicio sea del tipo varchar

Espero vuestra respuesta.
Saludos.
  #16 (permalink)  
Antiguo 09/10/2008, 11:37
Avatar de jaronu  
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 16 años, 2 meses
Puntos: 52
Respuesta: Problemas con la fecha

vale

inserta un nuevo campo en el form que sea oculto, hidden , y en el VALUE de ese nuevo campo del form pones la fecha y haces que dreamweaver recoja ese nuevo campo

<input name="hiddenField" type="hidden" id="hiddenField" value="<?php echo date("Y-m-d"); ?>" />


no dejes que dreamweaver haga el codigo por ti, es solo un consejo, pero a si no aprenderas algo de PHP y lo que quieres hacer es muy sencillo

un saludo

Última edición por jaronu; 09/10/2008 a las 11:50
  #17 (permalink)  
Antiguo 09/10/2008, 12:01
 
Fecha de Ingreso: abril-2008
Mensajes: 88
Antigüedad: 16 años
Puntos: 5
Respuesta: Problemas con la fecha

mira... SQL tiene por defecto que guardarlo con el formato YYYY-MM-DD asi que eso no lo puedes cambiar. bueno si puedes pero es mas facil que trabajes con el formato de la fecha intermediandola... como asi??' facil

la fecha la ingresan con un formato DD - MM - YY y luego con ese datos haces algo como

$arrayfecha= explode(" - ", $fecha);
$dia=$arrayfecha['0'];
$mes=$arrayfecha['1'];
$ano=$arrayfecha[''];

$fechaBD='20'.$ano.'-'.$mes.'-'.$dia;


luego la guardas $fechaBD en la base de datos

y cuando la deseas mostrar la fecha de nuevo

$fecha=el valor que tienes de la base de datos
$fechaarray=explode('-',$fecha);
$ano=$fechaarray['0'];
$mes=$fechaarray['1'];
$dia=$fechaarray['2'];
$year=- substr($ano,2,2);

$formatoFecha=$dia. ' - ' .$mes.' - '.$Ano;

y ya esta, problema resuelto....
espero que te sirva
  #18 (permalink)  
Antiguo 10/10/2008, 07:04
 
Fecha de Ingreso: septiembre-2007
Mensajes: 50
Antigüedad: 16 años, 6 meses
Puntos: 0
Respuesta: Problemas con la fecha

Estimados amigos.

Con vuestra inestimale ayuda he podido conseguir que el formulario inserte su fecha en la base de datos.

he hecho lo que me dijo JARONU, crear un campo oculto.

Ahora la página que imprime la feha la recibe: 2008-10-10 (año-mes-día)
Quiero que la reciba: día-mes-año

Si me decís el código, me tenéis que indicar el lugar exacto dónde colocarlo, pues hace unos días Jaronu me dió un código y lo he intentado, pero no consigo que funcione. Seguramente no lo coloco en el lugar que debe estar.

Os envío el código de la página que recibe la fecha de la tabla, para que me digáis el código y el lugar dónde debo ponerlo:

<?php require_once('Connections/conexionconsultas.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];
?>
<?php require_once('Connections/conexionconsultas.php'); ?>
<?php
$maxRows_con = 25;
$pageNum_con = 0;
if (isset($_GET['pageNum_con'])) {
$pageNum_con = $_GET['pageNum_con'];
}
$startRow_con = $pageNum_con * $maxRows_con;

mysql_select_db($database_conexionconsultas, $conexionconsultas);
$query_con = "SELECT * FROM `general`";
$query_limit_con = sprintf("%s LIMIT %d, %d", $query_con, $startRow_con, $maxRows_con);
$con = mysql_query($query_limit_con, $conexionconsultas) or die(mysql_error());
$row_con = mysql_fetch_assoc($con);

if (isset($_GET['totalRows_con'])) {
$totalRows_con = $_GET['totalRows_con'];
} else {
$all_con = mysql_query($query_con);
$totalRows_con = mysql_num_rows($all_con);
}
$totalPages_con = ceil($totalRows_con/$maxRows_con)-1;

$queryString_con = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_con") == false &&
stristr($param, "totalRows_con") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_con = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_con = sprintf("&totalRows_con=%d%s", $totalRows_con, $queryString_con);
?><!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>Documento sin t&iacute;tulo</title>
</head>

<body>
<table width="760" align="center">
<?php do { ?>
<tr bgcolor="#FFCC99">
<td width="85"><?php echo $row_con['Fecha']; ?></td>
<td width="412"><div align="center"><a href="datos_cliente.php?Id=<?php echo $row_con['Id']; ?>"><?php echo $row_con['reforma']; ?></a></div></td>
<td width="146"><a href="datos_cliente.php?Id=<?php echo $row_con['Id']; ?>"><?php echo $row_con['Localidad']; ?></a></td>
<td><a href="datos_cliente.php?Id=<?php echo $row_con['Id']; ?>"><?php echo $row_con['Provincia']; ?></a></td>
</tr>
<tr bgcolor="#FFFFCC">
<td width="85"></td>
<td colspan="2"><?php echo $row_con['Descripción']; ?></td>
<td width="97"></td>
</tr>
<?php } while ($row_con = mysql_fetch_assoc($con)); ?>
</table>
<table width="760" align="center">
<tr>
<td width="114"><div align="center">
<?php if ($pageNum_con > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_con=%d%s", $currentPage, max(0, $pageNum_con - 1), $queryString_con); ?>">Anterior</a>
<?php } // Show if not first page ?>
</div></td>
<td width="511">&nbsp;</td>
<td width="119"><div align="center">
<?php if ($pageNum_con < $totalPages_con) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_con=%d%s", $currentPage, min($totalPages_con, $pageNum_con + 1), $queryString_con); ?>">Siguiente</a>
<?php } // Show if not last page ?>
</div></td>
</tr>
</table>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($con);
?>
  #19 (permalink)  
Antiguo 10/10/2008, 07:23
Avatar de jaronu  
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 16 años, 2 meses
Puntos: 52
Respuesta: Problemas con la fecha

Como ya te dijeron MySQL tiene por defecto la fecha en formato año mes dia

para darle la vuelta al imprimir has de hacer lo que ya te han dicho mas arriba reiteradamente.

una cosa es que no sepas nada de php, pero acoplar el codigo que da la vuelta a la fecha en el tuyo, es algo muy sencillo.

Parate un momento a leer los post que tienes mas arriba y veras como es el code,

PERO INTENTALO Xd.

Un saludo
  #20 (permalink)  
Antiguo 11/10/2008, 10:27
Avatar de Carlojas  
Fecha de Ingreso: junio-2007
Ubicación: Shikasta
Mensajes: 1.272
Antigüedad: 16 años, 10 meses
Puntos: 49
Respuesta: Problemas con la fecha

Cita:
Iniciado por Carlojas Ver Mensaje
Que tal adibu, la solución que te dio jaronu debería funcionarte la probaste?obviamente con el valor rescatado de tu consulta, deja el campo de tu tabla tipo DATE
Código PHP:
<?php$fecha explode("-"$row_ver['Fecha']); 
$nfecha =  $fecha[2]."-".$fecha[1]."-".$fecha[0];
// Donde iría la fecha con el nuevo formato dentro de ciclo do While ?>
<td><div align="center"><?php echo $nfecha?></div></td>
Ahora si dices que no te funciona de esta forma puedes formatear la fecha directamente desde tu consuta utilizando la función MySQL DATE_FORMAT()
Código PHP:
$query_ver "SELECT *, DATE_FORMAT(Fecha, '%d-%m-%Y') AS Nfecha FROM `general`";
$query_limit_ver sprintf("%s LIMIT %d, %d"$query_ver$startRow_ver$maxRows_ver);
$ver mysql_query($query_limit_ver$conexionconsultas) or die(mysql_error());
$row_ver mysql_fetch_assoc($ver);
// Accedes al valor del array con la fecha ya formateada
echo $row_ver['Nfecha']; 

Saludos.
Efectivamente tienes que leer con detenimiento.



Saludos.
__________________
"SELECT * FROM Mujeres WHERE situacion NOT IN ('CASADAS','CON HIJOS','ATORMENTADAS','CUASI-ENNOVIADAS') AND personalidad <> 'INTENSA'"
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 12:42.