This is my code:
<?php $db_host = "localhost"; $db_user = "root"; $db_pwd = "111"; $database = "data"; //$term=$_POST["term"]; if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can’t connect to database"); if (!mysql_select_db($database)) die("Can’t select database"); if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; }; $start_from = ($page-1) * 25; // sending query $term = $_POST['term']; ///line19 $result = mysql_query("SELECT Assets_No,Asset_Description,Ownership FROM asset WHERE Asset_Class LIKE '%".$term."%' OR Location LIKE '%".$term."%' OR Serial_number LIKE '%".$term."%' OR PIC LIKE '%".$term."%'LIMIT $start_from ,25"); //select * from the_table where 1st_field like \"%$trimmed%\" //echo $term; if (!$result) { die("Query to show fields from table failed"); } $fields_num = mysql_num_fields($result); // $No = mysql_num_fields($result); echo "Table: Asset Maintenance_RBMP
"; echo "{$field->name} | "; //echo "{$field->No} | "; } echo "
$cell | "; echo "
///////////////////////////
I got a problem after searching the data in the first page the data come out is correct but after next page the result is incorrect data.
And shown an error is Notice: Undefined index: term in C:\xampp\htdocs\xampp\new2\search.php on line 19
Please help!!!