Gumbo
Erfahrenes Mitglied
Gut, probier mal Folgendes:
PHP:
<?php
function tokenizeQuoted( $string )
{
for( $tokens=array(), $nextToken=strtok($string, ' '); $nextToken!==false; $nextToken=strtok(' ') ) {
if( $nextToken{0}==chr(0x22) || $nextToken{0}==chr(0x27) ) {
$chr = $nextToken{0};
$nextToken = $nextToken{strlen($nextToken)-1} == $chr
? substr($nextToken, 1, -1)
: substr($nextToken, 1) . ' ' . strtok($chr);
}
$tokens[] = $nextToken;
}
return $tokens;
}
$query = '
SELECT
`id`,
`title`,
`autor`,
`datum`,
FROM
`downloads`
WHERE
`'.$suchtabelle.'` = "%' . implode('%" OR `'.$suchtabelle.'` = "%', array_map('mysql_real_escape_string', tokenizeQuoted($search))) . '%"
';
$result = mysql_query($query)
or die(mysql_error());
while( $row = mysql_fetch_array($result, MYSQL_ASSOC) ) {
echo '<pre>';
var_dump($row);
echo '</pre>';
}
?>