hola tengo este script :
uno.php
Código PHP:
Ver original<?php require('/Connections/hoysale.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
}
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;
}
}
$colname_des = "-1";
if (isset($_GET['ir'])) { $colname_des = $_GET['ir'];
}
$query_des = sprintf("SELECT * FROM formulario WHERE id_rubro = %s ORDER BY id_rubro DESC", GetSQLValueString
($colname_des, "int"));
$query_pre = "SELECT * FROM comentarios";
?>
<html>
<head>
<title>Sistema de noticias</title>
</head>
<body>
<p><?php echo $row_des['Descripcion']; ?>
<a href="/unos.php?ir=<?php echo $row_des['id_rubro']; ?>">preguntar</a>
</p>
<?php do { ?>
<p><?php echo $row_pre['comentario']; ?></p>
</body>
</html>
<?php
?>
y unos.php
Código PHP:
Ver original<?php require('/Connections/hoysale.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
}
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 comentarios (nombre, comentario) VALUES (%s, %s)", GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['comentario'], "text"));
$insertGoTo = "/uno.php";
if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ?
"&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING'];
}
}
$colname_pre = "-1";
if (isset($_GET['ir'])) { $colname_pre = $_GET['ir'];
}
$query_pre = sprintf("SELECT * FROM comentarios WHERE id_entrada = %s ORDER BY id DESC", GetSQLValueString
($colname_pre, "int")); ?>
<!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>Documento sin título</title>
</head>
<body>
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Nombre:</td>
<td><input type="text" name="nombre" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right" valign="top">Comentario:</td>
<td><textarea name="comentario" cols="50" rows="5"></textarea></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Insertar registro" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p> </p>
</body>
</html>
<?php
?>
no se en que estoy fallando para la pregunta sea segun la publicacion que aparece?
si me pueden ayudar muchas gracias !!!