0

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

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by AMADH
0

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

0

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%'";

0

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??

0

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??

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.