2 Replies - 984 Views - Last Post: 02 July 2009 - 06:17 PM Rate Topic: -----

#1 scootviva  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 02-July 09

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

Posted 02 July 2009 - 02:30 AM

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... :(

Attached image(s)

  • Attached Image

This post has been edited by scootviva: 02 July 2009 - 02:52 AM


Is This A Good Question/Topic? 0
  • +

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

#2 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3778
  • View blog
  • Posts: 13,687
  • Joined: 08-August 08

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

Posted 02 July 2009 - 05:01 AM

$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.
Was This Post Helpful? 0
  • +
  • -

#3 scootviva  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 02-July 09

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

Posted 02 July 2009 - 06:17 PM

thank CTphpnwb for the coding. it help me actualy :^: .

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


Thanks
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1