Initial commit
This commit is contained in:
67
search_note.php
Normal file
67
search_note.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
require_once("config.inc.php");
|
||||
$db = dbconnect();
|
||||
$wort= strtoupper($_GET['wort']);
|
||||
|
||||
$wort = str_replace (array("Ä", "Ö", "Ü", "ß","ä","ö","ü"), array("&AUML;", "&OUML;", "&UUML;", "&SZLIG;", "&AUML;", "&OUML;", "&UUML;"), $wort);
|
||||
|
||||
|
||||
$query = "SELECT a.lid, upper(notiz) notiz, date_format(datum, '%d.%m.%Y') datum1, ueberschrift
|
||||
FROM notizen a, quelle b
|
||||
WHERE a.lid = b.lid
|
||||
AND UPPER(notiz) LIKE '%$wort%'
|
||||
AND user = 'schwaral'
|
||||
ORDER BY datum DESC";
|
||||
#echo "$query<hr>";
|
||||
$result = $db->query( $query )
|
||||
or die ("Cannot execute query");
|
||||
|
||||
echo "<table width='100%'>";
|
||||
while ($row = $result->fetch_array()){
|
||||
|
||||
$notiz =str_replace ('"', '\"' , $row['notiz']);
|
||||
$notiz = preg_replace("/\r*|\n*/s", "", $notiz);
|
||||
$notiz = preg_replace("/(\r\n|\n|\r)/", "", $notiz);
|
||||
$notiz = strip_tags($notiz, '');
|
||||
$count = substr_count($notiz,"$wort");
|
||||
|
||||
echo "
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
$row[lid]
|
||||
</td>
|
||||
<td>
|
||||
$row[datum1]
|
||||
</td>
|
||||
<td>
|
||||
$row[ueberschrift]
|
||||
</td>
|
||||
<td>
|
||||
$count
|
||||
</td>
|
||||
";
|
||||
}
|
||||
|
||||
echo "</table>";
|
||||
/*
|
||||
|
||||
$text = 'Dies ist ein Test';
|
||||
echo strlen($text)."<br>"; // 17
|
||||
|
||||
echo substr_count($text, 'es')."<br>"; // 2
|
||||
|
||||
// wird der String auf 's ist ein Test' reduziert,
|
||||
// lautet das ausgegebene Ergebnis 1
|
||||
echo substr_count($text, 'es', 3)."<br>";
|
||||
|
||||
// wird der String auf 's i' reduziert,
|
||||
// lautet das Ergebnis 0
|
||||
echo substr_count($text, 'es', 3, 3)."<br>";
|
||||
|
||||
// generiert eine Warnung, da 5+13 > 17
|
||||
echo substr_count($text, 'es', 5, 13)."<br>";
|
||||
*/
|
||||
?>
|
Reference in New Issue
Block a user