hello,
i need your help
i have problem with my code php. i want to call and display data from database but this coding cannot working.
this's my code php.
searchform.php
<?php mysql_connect('localhost','root','') or die("Connection Failed");
mysql_select_db("profil")or die("Connection Failed");
$query = "SELECT * FROM tblreport";
$result = mysql_query($query); ?> <select name="searchtype"> <?php while ($line = mysql_fetch_array($result, MYSQL_ASSOC))
{ ?> <option value="<?php echo $line['Name'];?>"> <?php echo $line['Name'];?> </option> <?php } ?> </select> </center> <tr> <td><center>
enter search term
</center></td> </tr> <tr> <td><label for="search"></label> <center> <p> <input type="text" name="searchterm" id="search"> </p> <p> <input type="submit" name="search" id="submit" value="search">
** proc_search.php**
<?php
$searchtype=$_POST['searchtype'];
$searchterm=$_POST['searchterm'];
$searchterm= trim($searchterm);
if ( !$searchtype || !$searchterm)
{
echo "<center> data not found </center>";
exit;
}
@ $db = mysql_pconnect('localhost','root','');
if (!$db)
{
echo'Error: no connection databases.';
exit;
}
mysql_select_db('profil');
$query = "select * from asset_ict where" .$searchtype." like ".$searchterm." ";
$result = mysql_query($query);