Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/12/2004, 18:34
Avatar de adex
adex
 
Fecha de Ingreso: marzo-2002
Ubicación: Lima, Perú, América Latina
Mensajes: 445
Antigüedad: 22 años, 1 mes
Puntos: 0
Pregunta cortar palabra en consulta

hola amigos, estaba revisando en los post anteriores sobre cortar caracteres en una consulta a sql pero no he logrado hacerlo aver si me dan una manita por favor aca les dejo el codigo que he venido peleandome:

Código PHP:
<?
include("$urlPath/Noticias/conexion.php");
$conn mysql_connect("$hostbd","$loginBaseDatos","$passwordBaseDatos");
 
mysql_select_db("$nombreBaseDatos");
$condic "LIKE";
if(
strcmp("$ind","otros")==0)
 {
 
$condic "NOT REGEXP";
 
$indic "^[A-Z]";
 }
else
 
$indic "$ind%";
$q mysql_query("SELECT count(id) FROM $NoticiasData WHERE mostrar='1' AND titulo $condic '$indic'");
$max mysql_result($q,0);
$q mysql_query("SELECT id, titulon, fecha_dia, fecha_mes, fecha_anio, cat, idgaleria FROM $NoticiasData WHERE mostrar='1' AND titulon $condic '$indic' ORDER BY id DESC LIMIT 4");
while(
$res mysql_fetch_row($q))
{
 echo 
"<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
  <tr>
    <td width=\"4%\">"
;
      

if(
$res[5]=='0')
{
echo 
"
<img border=\"0\" src=\"$urlDirAtajo/Pix_News/Listar_Galeria_000.gif\" width=\"15\" height=\"15\">
"

}
else
{
echo 
"
<a href=\"$urlExtraGal/categories.php?cat_id=$res[6]\" target=\"_blank\"><img alt=\"Ver Galería de Fotos\" border=\"0\" src=\"$urlDirAtajo/Pix_News/Listar_Galeria_001.gif\" width=\"9\" height=\"16\"></a>
"
;
}
 echo 
" </td>
    <td width=\"20%\">fecha: $res[2]/$res[3]</td>
    <td width=\"76%\"><a title=\"Noticia N° $res[0]\" href=\"$urlDirNoticia/noticia.php?id=$res[0]\"><b>$res[1]</b></a></td>
  </tr>
  <tr>
    <td width=\"100%\" colspan=\"3\">
      <hr size=\"1\">
    </td>
  </tr>
</table>"
;
}
?>
en donde: titulon es lo que quiero limitar a solo 40 caracteres

$q = mysql_query("SELECT id, titulon, fecha_dia, fecha_mes, fecha_anio,

muchas gracias por su ayuda.

Última edición por adex; 19/12/2004 a las 18:35