veritabanı karekter limiti.
Arkadaşlar aşağıdaki verdiğim kodda veritabanından çekilen habericerik kısmına karekter sınırlaması koymak istiyorum bir kaç kod denedim ama başarılı olamadım bilğisi olan arkadaşlarının yardımını rica ediyorum
<?php require_once('../Connections/menu1.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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;
}
}
mysql_select_db($database_menu1, $menu1);
$query_haber = "SELECT * FROM haber ORDER BY id DESC";
$haber = mysql_query($query_haber, $menu1) or die(mysql_error());
$row_haber = mysql_fetch_assoc($haber);
$totalRows_haber = mysql_num_rows($haber);
?>
<style type="text/css">
body {
background-image: url(images/bg.jpg);
background-repeat: no-repeat;
}
.ustt {
font-weight: bold;
color: #FFF;
background-image: url(images/butonad.PNG);
}
.ustt td {
text-align: center;
}
</style>
<table width="775" border="0">
<tr class="ustt">
<td>id</td>
<td>haberbaslik</td>
<td>habericerik</td>
<td>olusturma</td>
<td>Düzenle</td>
<td>Sil</td>
</tr>
<?php do { ?>
<tr>
<td bgcolor="#FFFFFF"><?php echo $row_haber['id']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $row_haber['haberbaslik']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $row_haber['habericerik']; ?>
</td>
<td bgcolor="#FFFFFF"><?php echo $row_haber['olusturma']; ?></td>
<td> </td>
<td> </td>
</tr>
<?php } while ($row_haber = mysql_fetch_assoc($haber)); ?>
</table>
<?php
mysql_free_result($haber);
?>
Php
belli sayıda karakter cekmek istiyorsan fonksiyon su
substr("burası haber icerigi",0,1000);
ilk bolum cekilen veriyi icermekte , ikincisi ise hangi karakterden itibaren cekilmesini istiyorsan baslangıc
1000 ise limit