我有很多行數據。每行有3個單元格 - id,eesnimi,perenimi。我想能夠內聯編輯所有的單元格。我正在使用In place editor。如何獲得具體的表id到javascript?
如何獲取特定的單元格(我正在編輯的單元格)id
JavaScript(element_id字段),所以我知道在mysql中更改哪個元素。
的Javascript:
$(document).ready(function(){
$(".editme1").editInPlace({
url: 'http://localhost/petka/kast.php',
element_id: ??????,
show_buttons: true
});
});
HTML:
<table>
<?PHP
$sql="SELECT * FROM nimed";
$result = mysql_query($sql)or die(mysql_error());
WHILE ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<tr class="row">';
echo '<td class="editme1" id="id|'.$row["id"].'" title="id">'.$row["id"].'</td>';
echo '<td class="editme1" id="eesnimi|'.$row["id"].'" title="eesnimi">'.$row["eesnimi"].'</td>';
echo '<td class="editme1" id="perenimi|'.$row["id"].'" title="perenimi">'.$row["perenimi"].'</td>';
echo '</tr>';
}
?>
</table>
正如順便說一句,在'mysql_ *'功能被棄用,並容易發生注入攻擊。改爲使用[php數據對象](http://www.php.net/manual/en/intro.pdo.php)。 – Daedalus 2012-08-03 08:32:17