sql >> Database >  >> RDS >> Mysql

PHP mysql-query en geen echo van het herhalingsgedeelte

$sentence = "Marc Gasol is the brother of Pau Gasol";
$words = preg_split("/\s+/", $sentence);

//this will uniqueify your value set
$uniqueWords = array_keys(array_flip($words));

foreach($uniqueWords as $word){
    $parts[] = "name like '%".mysql_real_escape_string($word)."%'";  
}

$where = implode(" OR ", $parts);




$query = mysql_query("SELECT * FROM books WHERE $where "); 
$i = 0;
while($row = mysql_fetch_array($query)) {     
echo $row['name'][$i];     
$i++; 
} 


  1. Draaitafel Met 3 tafels

  2. De database-e-mailwachtrij stoppen/starten in SQL Server (T-SQL)

  3. Teruggegeven record beperken van SQL-query in Oracle

  4. Verschil tussen set, \set en \pset in psql