Que debo hacer con ese codigo ? :s
te muestro como lo tengo yo.
index.php
Código PHP:
<?php require_once('Connections/noticias.php'); ?>
<?php
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_noticias, $noticias);
$query_Recordset1 = "SELECT * FROM noticias";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $noticias) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
<table border="0">
<tr> </tr>
<?php do { ?>
<td valign="top"><span class="Estilo2"><?php echo $row_Recordset1['titulo']; ?></span><br />
<span class="Estilo3"><?php echo $row_Recordset1['noticia']; ?></span></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
panel.php
Código PHP:
<?php require_once('Connections/noticias.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 noticias (id, titulo, noticia) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['id'], "int"),
GetSQLValueString($_POST['titulo'], "text"),
GetSQLValueString($_POST['noticia'], "text"));
mysql_select_db($database_noticias, $noticias);
$Result1 = mysql_query($insertSQL, $noticias) or die(mysql_error());
}
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=iso-8859-1" />
<title>Documento sin título</title>
</head>
<body>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Titulo:</td>
<td><input type="text" name="titulo" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right" valign="top">Noticia:</td>
<td><textarea name="noticia" cols="50" rows="5"></textarea>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Insertar registro"></td>
</tr>
</table>
<input type="hidden" name="id" value="">
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
Ese codigo se lo tengo que agregar ?