mysql - Display Data from two Tables - Select two Tables at a time from a Database -


how select 2 different tables @ time ?

1st table (table name "table1")

capacity   comment  1.0        low 1.7        low   7.2        average 9.9        fine 10.0       great 

2nd table (table name "table2")

c1     c2     c3   c4  1.0     cc      dd 1.7     ad    ac   pd 10.0    aw      ad 

if input 1.0 should show

capacity comment c2   c3   c4     1.0       low    cc     pd 

update

    select a.capacity,a.comment, b.c1,b.c2,b.c3 table1 inner join table2 b on a.capacity=b.capacity a.capacity= $name    $rs = mysql_query( $sql ) or die('database error: ' . mysql_error());       $num = mysql_num_rows( $rs );      if($num >= 1 ){         echo "";         while($row = mysql_fetch_array( $rs )){     echo "<table>         <tr>             <th align='left' valign='middle'>capacity</th>             <td align='left' valign='middle'>$row[capacity]</td>         </tr>         <tr>             <th align='left' valign='middle'>c2</th>             <td align='left' valign='middle'>$row[c2]</td>             </tr>                        </table>";      } 

i have expected result (in frontend)

| capacity | 1.0| |      c2  | cc | 

but showing in doubt

i have expected result (in frontend)

| capacity | 1.0| |      c2  | cc |  | capacity | 1.0| |      c2  | cc | 

try query

select a.capacity, a.comment, b.c2, b.c3, b.c4  tbl1  inner join  tbl2 b on a.capacity=b.c1 a.capacity=1 

sql fiddle:

| capacity | comment | c1 | c2 | c3 | c4 | ------------------------------------------ |        1 |     low |  1 | cc | | dd | 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -