<?php
mysql_connect("localhost","root","");
mysql_select_db("database_name")
?>

<form name="search" action="">
Search: <input name="q" type="text" /><input name="search" type="submit" value="Search" />
</form>

<?php
if(isset($_GET['q'])){

// include database connection

$sql = "SELECT * FROM article WHERE title LIKE '".$_GET['q']."' ";
$exe = mysql_query($sql);
while($row = mysql_fetch_array($exe)){
}
?>
     <table>
     <tr>
     <td> <a href="article_detail.php?id=<?php echo $row['id'];?>" class="header_menu"> <?php echo $row['title']; ?> </a> </td>
     </tr>
</table>

<?php
}
?>

I wrote this code in my php form but this code cannot work. any friend can tell me that what is the problem of this code and how can i correct this code

> cannot work
That's not much to go on. Someone would be more likely to help if you clearly stated what the problem was.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.