Dear experties,
I want to display data from Mysql by keyword but my code doesn't work.
Maybe you have suggestion for this environment.

would need to see the code to see what you are trying to accomplish.

Thanks for reply.. there are my codes

include 'connection/db_connect.php';

<form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <label for="key"></label>
    <input type="text" name="key" id="key">
    <input type="submit" name="Submit" id="Submit" value="Submit">
  <table width="200">
    $sql ="SELECT * FROM user WHEN name LIKE '{%key%}'";
    while ($row=mysql_fetch_array($result)) {
      <td><?php echo $row['empNo']; ?></td>
      <td><?php echo $row['name']; ?></td>
    <?php }?>

the searching will act like DaniWeb search engine..
It will display result when the string entred contains in database field..
hurmm but my code doesn't work..

$key = $_POST['key'];
$sql = "SELECT * FROM user WHEN name LIKE '{%$key%}'";

you probably dont even need the {} and you may want to escape $key before you pop it in your query.

i had tried it but still no result..
it doesn't work..

Sorry, not sure why that happened.. if you copy and pasted directly I missed two parentheses.

should be:

$key = $_POST['key'];
$sql = "SELECT * FROM user WHERE name like '%$key%';";

My God!!
Thank you so much~~~ it's worked!!
yesterday i had tried change the code many ways but didn't put the ; qoute...
Awesome...Thank you s much ryantroop!