2013-10-09 119 views
0
$i = 1; 
$sql = " 
    SELECT 
     heroes.char_id, characters.char_name, heroes.class_id, heroes.count, 
     heroes.played, heroes.active FROM heroes, characters 
    WHERE characters.obj_Id = heroes.char_id AND heroes.played = 1 
    "; 
$query = mysql_query($sql); 
while($row = mysql_fetch_array($query)) 
{ 
    echo " 
    <tr> 
    <td><span id='lefttop'><b><font color='#007aa2'>".$i++."&nbsp;</font></td><td><b><font color='#f6ff00'>".$row['char_name']."</font></td></span><div style='float:right;'><td><b>&nbsp;".$row['count']."</td></div> <br /> 
    </tr> 
    "; 
} 

echo ""; 
?> 

任何人都可以幫忙嗎?即時通訊設法使一個英雄狀態腳本在Java服務器上,我需要連接到2個表是「英雄」(這是我得到的英雄)和「字符」(這是我得到的英雄名稱)如何連接php到navicat與2表

+3

Navicat的僅僅是一個數據庫管理工具。你使用的是哪個數據庫系統?這些桌子是怎麼樣的?你有沒有連接到你的PHP腳本中的數據庫? –

回答

0

試試這個廟:

<?php 
$sql1 = "SELECT * your table1"; 
$query1 = mysql_query($sql); 
while($row1 = mysql_fetch_array($query1)) 
{ 
echo "<tr>"; 
    $sql2 = "SELECT * your table2"; 
    $query2 = mysql_query($sql2); 
    while($row2 = mysql_fetch_array($query2)) 
    { 

     echo "<td>[yor Vars here]</td>"; 
    } 
echo "</tr>"; 
} 

?>