我創建了一個HTML表,它從SQL發佈查詢數據。它看起來像這樣:使PHP變量鏈接行特定
John Doe | 52 | 40 | (checkbox)
Jane Doe | 52 | 40 | (checkbox)
Tim Rose | 52 | 40 | (checkbox)
我需要李四的鏈接,以顯示他的時間條目,李四以顯示她的,等等。這是我到目前爲止的代碼:
$x = 0;
while($client_display_timecards = mysql_fetch_assoc($res_client_display_timecards))
{
$lname = $client_display_timecards['ContractorLName'];
$fname = $client_display_timecards['ContractorFName'];
$contractorid = $client_display_timecards['ContractorID'];
$totalhours = $client_display_timecards['SUM(TimeCards.HoursTotal)'];
$week = $client_display_timecards['Week'];
$current_cards[$x] = array(
'contractorfname' => "$fname",
'contractorlname' => "$lname",
'contractorid' => "$contractorid",
'week' => "$week"
);
echo <<<END
<tr>
<td class="cell_client_left" align="center">$fname $lname</td>
<td class="cell_client" align="center"><a href="week.php">$week</a></td>
<td class="cell_client" align="center">$totalhours</td>
<td class="cell_client_right" align="center">
<input type="checkbox" name="approve$x" value="$x" />
</td>
</tr>
END;
++$x;
}
我只需要每一個環節,以反映每一個人行中的信息,因爲現在,它只是使每一個查詢結果的鏈接到同一個地方。我需要在那裏放置某種循環嗎?我可以將一個單元格與其左側的單元格相關聯嗎?
不完全確定你在問什麼。你想要創建什麼「鏈接」;一個給用戶配置文件,究竟是什麼? – escproxy 2012-01-12 20:37:34
你的mysql查詢是什麼樣的?你的桌子結構是什麼? – davogotland 2012-01-12 20:37:52