Proper way to put the database table id on HTML Table
I need to get the table id on my HTML table. Currently, I displayed the
other attributes on HTML table but i diddn't put the index or the id.
Where I can put it? should I put it on the 'td' tag and hide it ?
this is my code so far.
<?php
mysql_connect("localhost", "xx", "xxx");
mysql_select_db('db_dev');
$query3 = "SELECT * FROM project_entry";
$result3 = mysql_query($query3);
?>
<table id="tableID">
<tr class="data-head">
<td>Client Name</td>
<td>Phase</td>
<td>Payment 1</td>
<td>Payment 2</td>
<td>Payment 3</td>
</tr>
<?php
while ($row3 = mysql_fetch_row($result3, MYSQL_BOTH)) {
$id = $row3[0]; //id
$companyname = $row3[1];
$client = $row3[2];
$package = $row3[3];
$payment1 = $row3[4];
$payment2 = $row3[5];
$payment3 = $row3[6];
echo '<tr>';
echo '<td><b>'.$client.'</b></td>';
echo '<td>
<select class="phase"
onchange="trackPhases(this.value)">
<option value="Design">Design</option>
<option value="Build-Out">Build-Out</option>
<option value="Launch">Launch</option>
</select>
</td>';
echo '<td><span class="price"><b>$' .$payment1.
'</b></span>
<select onchange="updatePayment1_Status(this.value)">
<option value="Owed">Owed</option>
<option value="Billed">Billed</option>
<option value="Payed">Payed</option>
</select></td>';
echo '<td><span class="price" ><b>$' .$payment2.
'</b></span>
<select onchange="updatePayment2_Status(this.value)">
<option value="Owed">Owed</option>
<option value="Billed">Billed</option>
<option value="Payed">Payed</option>
</select></td>';
echo '<td><span class="price"><b>$' .$payment3.
'</b></span>
<select onchange="updatePayment3_Status(this.value)">
<option value="Owed">Owed</option>
<option value="Billed">Billed</option>
<option value="Payed">Payed</option>
</select></td>';
echo '</tr>';
}
?>
</table>
the $id = $row3[0]; is the id of the table. Where I can put that? I am new
on php development. please help me. and also, How I can access that when
clicking every table row?
Here is the sample output.
I need to do this because I am doing data updates using AJAX.
No comments:
Post a Comment