
12/09/2007, 11:31
|
 | | | Fecha de Ingreso: agosto-2007 Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 17 años, 8 meses Puntos: 28 | |
Problemas con sistema de noticias Saludos,
desarrollando un sistema de noticias quise hacer la paginacion y que desde un panel pudiese eliminar o modificar las mismas y no he podido... y no se muestran todos los registros.. solo el primero.. alguien podria decirme como hacer q salgan todos los registros???... y como hacer la paginacion?
Código:
<?php virtual('Connections/noticias.php'); ?>
<?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"] == "form2")) {
$insertSQL = sprintf("INSERT INTO noticias (id, fecha, noticia) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['id'], "int"),
GetSQLValueString($_POST['fecha'], "date"),
GetSQLValueString($_POST['noticia'], "text"));
mysql_select_db($database_noticias, $noticias);
$Result1 = mysql_query($insertSQL, $noticias) or die(mysql_error());
$insertGoTo = "registro.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_noticias, $noticias);
$query_Recordset1 = "SELECT * FROM noticias";
$Recordset1 = mysql_query($query_Recordset1, $noticias) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?><!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=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
</form>
<form action="<?php echo $editFormAction; ?>" method="post" name="form2" id="form2">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Fecha:</td>
<td><input type="text" name="fecha" value="<?php echo $row_Recordset1['fecha']; ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right" valign="top">Noticia:</td>
<td><textarea name="noticia" cols="50" rows="5"><?php echo $row_Recordset1['noticia']; ?></textarea>
</td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Insert record" /></td>
</tr>
</table>
<input type="hidden" name="id" value="" />
<input type="hidden" name="MM_insert" value="form2" />
</form>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10%">ID</td>
<td width="14%">Fecha</td>
<td width="60%">Noticia</td>
<td width="16%"> </td>
</tr>
<tr>
<td><?php echo $row_Recordset1['id']; ?></td>
<td><?php echo $row_Recordset1['fecha']; ?>;</td>
<td><?php echo $row_Recordset1['noticia']; ?></td>
<td>Eliminar / Modificar</td>
</tr>
</table>
<p> </p>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
Última edición por T4ke0veR; 12/09/2007 a las 11:37 |