PHP School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a PHP Expert!

Join 300,443 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,523 people online right now. Registration is fast and FREE... Join Now!




Please Help. How to search into two table in same DB

 

Please Help. How to search into two table in same DB, search code

scootviva

2 Jul, 2009 - 01:30 AM
Post #1

New D.I.C Head
*

Joined: 2 Jul, 2009
Posts: 3

Hai im from Malaysia..and i need idea to solve my probleum.

my first probleum is:
I having probleum for making search code. to search data in this 2 table.

i using Mysql as DB
my DB name is: lesenanjing
and the table is:rm10 and rm20

i have attach my coding for the helper to view. This search code works fine but it select only one table (rm10).

second probleum is:
i want to view all data in this two table with single click to see if their is a duplicate data in it.

plz help me... sad.gif

This post has been edited by scootviva: 2 Jul, 2009 - 01:52 AM


Attached thumbnail(s)
Attached Image
User is offlineProfile CardPM
+Quote Post


CTphpnwb

RE: Please Help. How To Search Into Two Table In Same DB

2 Jul, 2009 - 04:01 AM
Post #2

D.I.C Lover
Group Icon

Joined: 8 Aug, 2008
Posts: 2,065



Thanked: 151 times
Dream Kudos: 100
Expert In: PHP

My Contributions
CODE
$tbl_name = "rm10";
$search1 = mysql_real_escape_string($_POST['search1']);
$sql1  = "SELECT * FROM $tbl_name WHERE NoKP LIKE '%$search1%'";
$tbl_name = "rm20";
$sql2  = "SELECT * FROM $tbl_name WHERE NoKP LIKE '%$search1%'";
$result1 = mysql_query($sql1);
$result2 = mysql_query($sql2);

From here it's just a matter of displaying the data from the two results. If you want to automatically compare the results, that's a little more difficult because you need to compare each row of one result with every row of the other.

User is offlineProfile CardPM
+Quote Post

scootviva

RE: Please Help. How To Search Into Two Table In Same DB

2 Jul, 2009 - 05:17 PM
Post #3

New D.I.C Head
*

Joined: 2 Jul, 2009
Posts: 3

thank CTphpnwb for the coding. it help me actualy icon_up.gif .

i just want to ask, how to view all data in two table with same database.


Thanks
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 01:28AM

Live PHP Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month