how to add a dynamic param

Posted by user569846 on Stack Overflow See other posts from Stack Overflow or by user569846
Published on 2011-01-10T12:46:51Z Indexed on 2011/01/10 12:53 UTC
Read the original article Hit count: 214

Filed under:
|
|

the jquery plugin that im using is this http://code.google.com/p/jquery-in-place-editor/

if i have a table like this

<table>
<thead>
<tr>
<th>id</th>
<th>first name </th>
<th>last name </th>
</tr>
</thead>

<tbody>
<tr>
<td class="id">1</td>
<td class="fname">sarmen</td>
<td class="lname">mikey</td>
</tr>

<tr>
<td class="id">2</td>
<td class="fname">john</td>
<td class="lname">angelo</td>
</tr>

<tr>
<td class="id">3</td>
<td class="fname">sarmen</td>
<td class="lname">grande</td>
</tr>
</tbody>
</table>

and my js looked something like this

$("td.fname").editInPlace({
    url: 'ajax.php',
    params: '',
    show_buttons: true          
});

then lets say i click on the first record to edit it which is fname of sarmen. how can i pass a param that only accociates id 1 ? because if i do a query of lets say

"update tbl_users set fname = '$_POST['update_value']' where fname = '$_POST['original_html']'"

(note: im just showing an example so no need to clean posts if that was bothering you :) )

if i run this query the fname of sarmen will update in two records rather than one. How can i only update to id of 1 being to update only one record.

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery