hola buenas tengo este script
Código PHP:
Ver original<?php require_once('Connections/hoysale.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
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 (id_noticia, detalle) VALUES (%s, %s)", GetSQLValueString($_POST['id_noticia'], "int"),
GetSQLValueString($_POST['detalle'], "text"));
$insertGoTo = "preguntar.php";
if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ?
"&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING'];
}
}
//NeXTenesio Special List Recordset
$colname_noticias = "-1";
if (isset($_GET['id'])) { $colname_noticias = $_GET['id'];
}
$query_noticias = sprintf("SELECT * FROM noticias WHERE id = %s ORDER BY id DESC", $colname_noticias); //End NeXTenesio Special List Recordset
//NeXTenesio Special List Recordset
$colname_comentar = "-1";
if (isset($_GET['id'])) { $colname_comentar = $_GET['id'];
}
$query_comentar = sprintf("SELECT * FROM comentarios WHERE id_comentario = %s ORDER BY id_comentario DESC", $colname_comentar); //End NeXTenesio Special List Recordset
?>
<table width="500">
<tr>
<td><?php echo $row_noticias['id']; ?></td>
<td><a href="comentar.php?id=<?php echo $row_noticias['id']; ?>"><?php echo $row_noticias['detalle']; ?></a></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right" valign="top">Detalle:</td>
<td><textarea name="detalle" 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_noticia" value="<?php echo $row_noticias['id']; ?>">
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
anda bien de bien. lo que quiero es es acortar la cadena
Código PHP:
Ver original<?php echo $row_noticias['detalle']; ?>
que donde se muestra la noticia, o sea lo que quiero es que solo se muestre una parte de la misma y tenga un
leer más..
gracias!!!