How to disable this search.php file from inserting MYSQL entries?
<p>I'm currently using a script which when someone searches for a movie on my site, it checks the MySQL db to see if the movie data exists.</p>

<p>If it does, it shows the search result. If it doesn't, it goes to IMDB.com, scrapes content and then inserts that data into the MySQL database.</p>

<p>Does anyone know from quickly looking at the code below if there's a way to quickly disable that from happening by just commenting out a line or will it require someone to go over it thoroughly?</p>

<p>I don't want it to go to IMDB if it doesn't see the movie data in the MySQL DB.</p>

<pre><code>    &lt;?php
function PageMain() {
global $TMPL;
include('./includes/imdb.php');

    $all = 'Sorry, it seems that the movie you where looking for doesn\'t exist or we         don\'t have it in our database...';
$text = $_GET['a'];
$name = htmlspecialchars(urldecode($_GET['q']), ENT_QUOTES);

$per_page = 50;
$page_query = mysql_query("SELECT COUNT(id) from imdb WHERE title LIKE '%%$name%'");
$pages = ceil(mysql_result($page_query, 0) / $per_page);

$page = (isset($_GET['page']) AND (int)$_GET['page'] &gt; 0) ? (int)$_GET['page'] : 1;
$start = ($page - 1) * $per_page;

if(!empty($name)) {
    $queryid = 'SELECT * FROM imdb WHERE title LIKE "%%'.$name.'%"';
    if(mysql_fetch_row(mysql_query($queryid)) &gt;= 1) {
    $query = "SELECT * FROM imdb WHERE title LIKE '%%%s%%' LIMIT %d, %d;";
    $query = sprintf($query, $name, $start, $per_page);
    $result = mysql_query($query);

        $TMPL_old = $TMPL; $TMPL = array();
        $skin = new skin('search/rows'); $all = '';
        while($TMPL = mysql_fetch_assoc($result)) {
            if ($TMPL['votes'] == NULL) {$TMPL['votes'] = '?';}
            if ($TMPL['tagline'] == NULL) {$TMPL['tagline'] = 'None';}
            $TMPL['title_encoded'] = str_replace("+", "-",     urlencode($TMPL['title']));
            $TMPL['genre'] = '';
            foreach(explode(', ', $TMPL['genres']) as $v)
            $TMPL['genre'] .= '&lt;a href="/genre/'.$v.'"&gt;'.$v.'&lt;/a&gt;, ';
            $TMPL['actor'] = '';
            foreach(explode(', ', $TMPL['actors']) as $v) 
            $TMPL['actor'] .= '&lt;a href="/actor/'.str_replace("+", "-",     urlencode($v)).'"&gt;'.$v.'&lt;/a&gt;, ';
            $all .= $skin-&gt;make();
        }
        //Incepe selectarea actorilor
        $query_actors = "SELECT `actors` FROM `imdb` ORDER BY `id` DESC LIMIT 0,3";
        $actors_result = mysql_query($query_actors);

        $TMPL = array (); $skin = new skin('shared/actors'); $actors = '';
        while ($TMPL = mysql_fetch_assoc($actors_result))
        {
            $TMPL['actor'] = '';
            foreach(explode(', ', $TMPL['actors']) as $v)
            $TMPL['actor'] .= '&lt;a href="/actor/'.str_replace("+", "-", urlencode($v)).'"&gt;'.$v.'&lt;/a&gt; &lt;br /&gt;';        
            $actors .= $skin-&gt;make();
        }
        // Incepe paginarea
        $skin = new skin('shared/pagination'); $pagination = '';
        if ($pages &gt;= 1 &amp;&amp; $page &lt;= $pages) {
        for ($x=1; $x&lt;=$pages; $x++) {
            $TMPL['pagination'] = ($x == $page) ? '&lt;strong&gt;&lt;a href="/index.php?a=search&amp;q='.urlencode($name).'&amp;page='.$x.'"&gt;'.$x.'&lt;/a&gt;&lt;/strong&gt; ' : '&lt;a href="/index.php?a=search&amp;q='.urlencode($name).'&amp;page='.$x.'"&gt;'.$x.'&lt;/a&gt; ';
            $pagination .= $skin-&gt;make();
            }
        }
        $TMPL = $TMPL_old; unset($TMPL_old);

        $TMPL['actors'] = $actors;
        $TMPL['rows'] = $all;
        $TMPL['pagination'] = $pagination;

        $text = 'content';
    } else {
    $imdb = new Imdb();
    $movieArray = $imdb-&gt;getMovieInfo(htmlEntities($_GET['q']));

    if(!isset($movieArray['title_id'])) { $TMPL['rows'] = $all; } else {

    $title_id = $movieArray['title_id'];
    $poster = $movieArray['poster'];
    $title = $movieArray['title'];
    $tagline = $movieArray['tagline'];
    $year = $movieArray['year'];
    $release = $movieArray['release_date'];
    $votes = $movieArray['rating'];
    $plot = $movieArray['plot'];
    $runtime = $movieArray['runtime'];
    $storyline = $movieArray['storyline'];
    $genres = $movieArray['genres'];
    $stars = $movieArray['stars'];
    $oscars = $movieArray['oscars'];
    $mpaa = $movieArray['mpaa_rating'];
    $country = $movieArray['country'];
    $actori = implode(", ", $stars);
    $genuri = implode(", ", $genres);
    $countries = implode(", ", $country);
    $trivia = $movieArray['trivia'];

    $selectData = "SELECT * FROM `imdb` where `imdbid` = '$title_id'";

    if(strlen($poster) &gt;= 5) {
    if(mysql_fetch_row(mysql_query($selectData)) === false) {
    $insertData = "INSERT INTO `imdb` (`imdbid` ,  `poster` ,  `title` ,  `tagline` ,  `plot` ,  `year` , `release`, `country`, `runtime` ,  `storyline`, `genres`, `actors`, `votes`, `oscars`, `mpaa`, `trivia`) VALUES ('$title_id', 'posters/$title_id.jpg', '$title', '$tagline', '$plot', '$year', '$release', '$countries', '$runtime', '$storyline', '$genuri', '$actori', '$votes', '$oscars', '$mpaa', '$trivia')";
    mysql_query($insertData);

    $ch = curl_init ($poster);
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.12 Safari/535.2');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
    $rawdata=curl_exec ($ch);
    curl_close ($ch);

    $fp = fopen('posters/'.$title_id.'.jpg', 'w');
    fwrite($fp, $rawdata); 
    fclose($fp);
    }
    } else {
    if(mysql_fetch_row(mysql_query($selectData)) === false) {
    $insertData = "INSERT INTO `imdb` (`imdbid` ,  `poster` ,  `title` ,  `tagline` ,  `plot` ,  `year` , `release`, `country`, `runtime` ,  `storyline`, `genres`, `actors`, `votes`, `oscars`, `mpaa`, `trivia`) VALUES ('$title_id', 'posters/noposter.jpg', '$title', '$tagline', '$plot', '$year', '$release', '$countries', '$runtime', '$storyline', '$genuri', '$actori', '$votes', '$oscars', '$mpaa', '$trivia')";
    mysql_query($insertData);
    }
    }

    $query = "SELECT * FROM imdb WHERE title LIKE '%%%s%%' LIMIT %d;";
    $query = sprintf($query, $name, 40);
    $result = mysql_query($query);  

        $TMPL_old = $TMPL; $TMPL = array();
        $skin = new skin('search/rows'); $all = '';
        while($TMPL = mysql_fetch_assoc($result)) {
            if ($TMPL['votes'] == NULL) {$TMPL['votes'] = '?';}
            if ($TMPL['tagline'] == NULL) {$TMPL['tagline'] = 'None';}
            $TMPL['title_encoded'] = str_replace("+", "-", urlencode($TMPL['title']));
            $TMPL['genre'] = '';
            foreach(explode(', ', $TMPL['genres']) as $v)
            $TMPL['genre'] .= '&lt;a href="/genre/'.$v.'"&gt;'.$v.'&lt;/a&gt;, ';
            $TMPL['actor'] = '';
            foreach(explode(', ', $TMPL['actors']) as $v) 
            $TMPL['actor'] .= '&lt;a href="/actor/'.str_replace("+", "-", urlencode($v)).'"&gt;'.$v.'&lt;/a&gt;, ';
            $all .= $skin-&gt;make();
        }
        //Incepe selectarea actorilor
        $query_actors = "SELECT `actors` FROM `imdb` ORDER BY `id` DESC LIMIT 0,3";
        $actors_result = mysql_query($query_actors);

        $TMPL = array (); $skin = new skin('shared/actors'); $actors = '';
        while ($TMPL = mysql_fetch_assoc($actors_result))
        {
            $TMPL['actor'] = '';
            foreach(explode(', ', $TMPL['actors']) as $v)
            $TMPL['actor'] .= '&lt;a href="/actor/'.str_replace("+", "-", urlencode($v)).'"&gt;'.$v.'&lt;/a&gt; &lt;br /&gt;';        
            $actors .= $skin-&gt;make();
        }
        $TMPL = $TMPL_old; unset($TMPL_old);

        $TMPL['actors'] = $actors;
        $TMPL['rows'] = $all;

        $text = 'content';
    }
    }
}
$TMPL['query'] = $name;
$TMPL['title'] = 'yourgamecodes.com/ - Movie - '.$name.'';

$skin = new skin("search/$text");
return $skin-&gt;make();
}
    ?&gt;
</code></pre>
