Jak dodać skrócony opis do tabeli która jest pobierana z bazy danych w zmiennej opis, jak dodaje samą zmienną opis to jest zbyt długi chce go skrócić.
oto kod strony:
<?
include("include/gora.php");
echo "
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-2\"
</head>
<body>
<CENTER>
<form action=\"rezultaty.php\" method=\"post\">
Szukaj wg:
</BR>
</BR>
<select name=\"metoda_szukania\">
<option value=\"przedmiot\">Przedmiot
<option value=\"autor\">Autor
<option value=\"kat\">Kategoria
<option value=\"nr_inw\">Nr. inw
</select>
</BR>
</BR>
WprowadĽ poszukiwane wyrażenie:<br />
<input name=\"wyrazenie\" type=\"text\">
</BR>
</BR>
<input type=\"submit\" value=\"Szukaj\">
</form>
</center>
</body>
</html>
";
?>
<html>
<head>
<title>Karta eksponatów - wyniki wyszukiwania</title>
<meta http-equiv="Content-Type" content="text/html; CHARSET=ISO-8859-2"
</head>
<body>
<table align="center" border="" width="95%" cellspacing="0" cellpadding="0" >
<tr>
<td width="91%" colspan="7" bgcolor="#C0C0C0">
<p align="center"><b><font size="2">Wykaz kart eksponatów</font></b></td>
</tr>
<tr>
<td width="4%" align="center" bgcolor="#E0E0E0"><p align="center"><font size="2">ID</font></td>
<td width="10%" align="center" bgcolor="#E0E0E0"><p align="center"><font size="2">Przedmiot</font></td>
<td width="8%" align="center" bgcolor="#E0E0E0"><font size="2">Fotografia</font></td>
<td width="10%" align="center" bgcolor="#E0E0E0"><font size="2">Autor</font></td>
<td width="8%" align="center" bgcolor="#E0E0E0"><font size="2">Kategoria</font></td>
<td width="10%" align="center" bgcolor="#E0E0E0"><font size="2">Nr inw.</font></td>
<td width="10%" align="center" bgcolor="#E0E0E0"><font size="2">skrócony opis</font></td>
<td width="8%" align="center" bgcolor="#E0E0E0"><p align="center"><font size="2">Działanie</font></td>
</body>
</HTML>
<?
include("include/globals.php");
require("paging_class.php");
$paging=new paging(8,3);
require("../config.php");
$qw=explode_keyword($_GET[keyword]);
$paging->query("select * from historia where $qw order by karta_id asc");
$page=$paging->print_info();
if (!empty($page["keyword"]))
echo "Keyword : <b>$page[keyword]</b><br>\n";
if (empty($page["total"])) {
echo "<u>Not Found</u>\n";
} else {
echo "Rekord $page[start] - $page[end] z $page[total] [wszystkich $page[total_pages] stron]<br>\n";
}
while ($result=$paging->result_assoc())
{
$color=$paging->print_color("#999999","#999999")
?>
<?
{
echo "<tr><div align=\"center\">
<td width=\"4%\">".$result['karta_id']."</td>
<td width=\"16%\">".$result['przedmiot']."</td>
<td width=\"10%\"><center><img src=../../../upload/hi/".$result['obrazek'].".jpg width='160'></center></td>
<td width=\"14%\">".$result['autor']."</td>
<td width=\"8%\">".$result['kat']."</td>
<td width=\"10%\">".$result['nr_inw']."</td>
<td width=\"10%\">".$result['opis']."</td> <--ale wyświetla cały opis niestety
<td width=\"8%\"><center><a href=\"karta.php?id=".$result['karta_id']."\">Pokaż kartę</a></center></td>
</tr></div>";
}
}
echo" </table>\n";
echo "<A HREF=\"szukaj.php?&page=1\">pierwsza </A>";
echo $paging->print_link();
//FUNCTION
function explode_keyword($q)
{
//trim
$q=trim($q);
$q=preg_replace("/[\s]+/"," ",$q);
$mode="AND";
$q2=explode(" ",$q);
for ($i=0;$i<count($q2);$i++) {
$condition=$condition."nr_inw"." like '%".$q2["$i"]."%' ".$mode." ";
}
$condition=substr($condition,0,-4);
return $condition;
}
?>
<?
echo "<A HREF=\"szukaj.php?&page=$page[total_pages]\">ostatnia</A>";
?>
<?php
include("count.php")
?>
Proszę o pomoc