0

私はこのクエリを持っています:

$result = mysqli_query($con,"SELECT * FROM b_tasks_report WHERE TASK_ID=$taskid ORDER BY WEEK_ID");
$current_week_id = -1;
while($row = mysqli_fetch_array($result))
{
if($current_week_id != $row['WEEK_ID'])
{
  if($current_week_id != - 1)
   {      
      echo "</table>";
   }
echo "<table>";

echo "<tr class='no-border'><td class='no-border'><div class='task-detail-title'>Week Number: " . $row['WEEK_ID'] . "</div></td></tr>";         
echo "<tr>";
echo "<th width='100'>Day</th>";
echo "<th width='75'>Start</th>";
echo "<th width='75'>End</th>";
echo "<th width='100'>Billable Hours</th>";
echo "<th width='100'>Non Billable Hours</th>";
echo "</tr>";
$current_week_id = $row['WEEK_ID'];
}
echo "<tr>";
echo "<td class='tdclass'>" . $row['DAY'] . "</td>";
echo "<td class='tdclass'>" . $row['START'] . "</td>";
echo "<td class='tdclass'>" . $row['END'] . "</td>";
echo "<td class='tdclass'>" . $row['BILLABLE_HOURS'] . "</td>";
echo "<td class='tdclass'>" . $row['NON_BILLABLE_HOURS'] . "</td>";
echo "</tr>";
}
  if($current_week_id != - 1)
   {      
      echo "</table>";
   }

これにより、週 ID ごとに個別のテーブルが提供されます。ただし、上記の結果に関連付けられている各テーブルの下に表示するボタンを取得しようとしています。WEEK_ID の値でボタンを追加することは可能ですか。現在、上と下にボタンを値で追加すると:

<input type='image' name='submit' src="image/button.jpg" value=" . $row['WEEK_ID'] . ">

上のテーブルには正しい ID が表示されず、下のテーブルには何も表示されません。これがなぜなのかはわかりますが、テーブルの下にこのボタンを関連付けることができますか?

4

1 に答える 1

0

これを PHP タグの外側で使用します。

<input type="image" name="submit" src="image/button.jpg" value="<?php echo $row['WEEK_ID'] ?>">

これを PHP タグ内で使用します。

echo '<input type="image" name="submit" src="image/button.jpg" value="' . $row['WEEK_ID'] . '">';
于 2013-11-01T14:08:32.303 に答える