Where is the problem in my php coding

I’m creating a search system on my website with mysql and php but there is error plz tell me where?
please see the 3 attached files
INDEX.PHP:

Untitled Document

Search Engine with PHP

SEARCH.PHP Untitled Document

Search Engine with PHP

<?PHP function getmicrotime() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } $connection_string = dirname(__FILE__) . "/connectionstring.php"; require_once($connection_string); mysql_select_db("test") or die ( 'Unable to select database.' ); $RESULTS_LIMIT=10; if(isset($_GET['search_term']) && isset($_GET['search_button'])) { $search_term = $_GET['search_term']; if(!isset($first_pos)) { $first_pos = "0"; } $start_search = getmicrotime(); $sql_query = mysql_query("SELECT * FROM news WHERE MATCH(title,article) AGAINST('$search_term')"); many mathces (too many matches cause returning of 0 results) if($results = mysql_num_rows($sql_query) != 0) { $sql = "SELECT * FROM news WHERE MATCH(title,article) AGAINST('$search_term') LIMIT $first_pos, $RESULTS_LIMIT"; $sql_result_query = mysql_query($sql); } else { $sql = "SELECT * FROM news WHERE (title LIKE '%".mysql_real_escape_string($search_term)."%' OR article LIKE '%".$search_term."%') "; $sql_query = mysql_query($sql); $results = mysql_num_rows($sql_query); $sql_result_query = mysql_query("SELECT * FROM news WHERE (title LIKE '%".$search_term."%' OR article LIKE '%".$search_term."%') LIMIT $first_pos, $RESULTS_LIMIT "); } $stop_search = getmicrotime(); $time_search = ($stop_search - $start_search); } ?> CONNECTIONSTRING.PHP: <?php $hostname_MyConnectionPHP = "localhost"; $database_MyConnectionPHP = "database"; $username_MyConnectionPHP = "usrname"; $password_MyConnectionPHP = "mypassword"; $connections = mysql_connect($hostname_MyConnectionPHP, $username_MyConnectionPHP, $password_MyConnectionPHP) or die ( "Unabale to connect to the database" ); ?>

What errors? Why should we search through your code and find them for you.

Yea it would really helped if you listed the errors. I don’t think anyone will take the time and look through your code for you just to find your problem. Without knowing the error to begin with.

I stopped looking at the first hint of deprecated mysql code.

Sponsor our Newsletter | Privacy Policy | Terms of Service