need help making search page
<p>im new in Php i need help why this code is not working </p>

<pre><code> &lt;body&gt;
    &lt;h2&gt;Search Engine&lt;/h2&gt;
    &lt;form action='./sch.php' method='get'&gt;
        &lt;input type='text' name='k' size='50' value='&lt;?php echo $_GET['k'] ?&gt;' /&gt;
        &lt;input type='submit' value='Search'/&gt;
    &lt;/form&gt;
    &lt;hr /&gt;
    &lt;?php
    $k = $_GET['k'];
    $terms = explode(" ", $k);
    $query = "SELECT * FROM search WHERE ";



$i = 1;

foreach($terms as $each)
    {
        $i++;
        if($i==1)
        $query.="keywords like '%$each%'";

        else

        $query.=" OR keywords like '%$each%'";

    }

    //connect
    mysql_connect("localhost", "root", "");
    mysql_select_db("new");

    $query = mysql_query($query);
    $num_rows = mysql_num_rows($query);

    if ($num_rows &gt; 0){

        while($row = mysql_fetch_assoc($query)){
            $id = $row['id'];
            $title = $row['title'];
            $description = $row['description'];
            $keywords = $row['Keywords'];
            $link = $row['link'];

            echo "&lt;h2&gt;&lt;a href='$link'&gt;$title&lt;/a&gt;&lt;/h2&gt;
            $description&lt;br /&gt;&lt;br /&gt;";
        }

    }
    else
        echo "No results found for \"&lt;b&gt;$k&lt;/b&gt;\"";

    //disconnect
    mysql_close();

    ?&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
