i want search ,whene i want search this time show all same information from sql server using by php code


case "search":

$ID=$_POST;


$bodyInfoText="$ID";


include("db_connect.inc.php");


$SQL="select * from tbl_person where kamal='%$ID%'";
$result=mysql_query($SQL,$con);

if($result):

if (mysql_num_rows($result)==1):
$bodyInfoText="show_user_info.inc.tpl.php";
else:
$bodyInfoText="$ID $Pass inValid user";
endif;

else:
$bodyInfoText="Fail to select :".mysql_error($con);

endif;


break;


but whene this comment give this time show one name , but i want same all name show this time from sql server

sory this line $SQL="select * from tbl_person where kamal='%$kamal%'";

Hi,

Why don't you try this in your query?

$SQL="select * from tbl_person where kamal like '%$ID%'";

ADM

sory this line $SQL="select * from tbl_person where kamal='%$kamal%'";

i have two tables with listings of titles in my mysql database.
i know how to create basic form and post/get and stuff..
i created a search bar that send the input to search.php
but then i have no idea how to compare/match the data and echo out the matches... please help??

This is what I would suggest, do a left join then do the query like I suggested. This should work, if you need an example of how it can be done try these

http://teamtutorials.com/web-development-tutorials/php-tutorials/creating-a-form-that-will-search-a-mysql-database

http://www.w3schools.com/sql/sql_join_left.asp

Thanks,

ADM

i have two tables with listings of titles in my mysql database.
i know how to create basic form and post/get and stuff..
i created a search bar that send the input to search.php
but then i have no idea how to compare/match the data and echo out the matches... please help??

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.