Hi. Assume there are contents in DB as follows.

------------------------
name favorites
John cat
Peter dog
-------------------------

If as soon as I enter "John Peter" the following screen should display with no page movement.

Input: John Peter

Output:
:The favorites:
John cat
Peter dog

Is it possible to impliment? Give me some advice please. Thanks

Is this the code your after

<?php
if (isset($_POST) && !empty($_POST)) {
    $words=explode(' ',$_POST['name']);
    $sql='SELECT * FROM `table` WHERE';
    foreach ($words AS $word) {
        $sql.=' `name`="'.mysql_real_escape_string($word).'" OR';
        }
    $sql=substr($sql,0,-3);
    $r=mysql_query($sql) or die($sql.'<hr>'.mysql_error());
    while ($row=mysql_fetch_array($r) {
        echo $row[0].'------'.$row[1].'<br>';
        }
    }
?>

"With no page movement" --- If you meant that the result should be displayed without the page submission, then you will have to use ajax.
For more insight on how to work on Ajax, take a look at the following link
http://w3schools.com/ajax/default.asp

Hi. Assume there are contents in DB as follows.

------------------------
name favorites
John cat
Peter dog
-------------------------

If as soon as I enter "John Peter" the following screen should display with no page movement.

Input: John Peter

Output:
:The favorites:
John cat
Peter dog

Is it possible to impliment? Give me some advice please. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.