Page 1 of 1

inplace editor

Posted: Tue Jun 12, 2007 2:32 am
by pleigh
hi, i really need your help. :) i have this code from index.php

Code: Select all

<form id="inplace">
					<table border="="1" width="40%" cellpadding="0" cellspacing="0" id="edit_handle">
						<?php
							$rquery = "SELECT RightsKey, RightsDesc FROM hh_rights";
							$rresult = mysql_query($rquery) or die(mysql_error());
							$edit = 0;
							
							if ($rresult) {
								while ($row = mysql_fetch_array($rresult, MYSQL_NUM)) {
									$edit++;
									echo "<tr>
											<td><p id='edit$edit' name='rights' value='" . $row[0] . "'> " . $row[1] . "</p></td>
										  </tr>";
								}
							} else {
								echo "system error";
							}
						?>
						<script type="text/javascript">
						 new Ajax.InPlaceEditor('edit1', 'rights-edit.php');
						 new Ajax.InPlaceEditor('edit2', 'rights-edit.php');
						 new Ajax.InPlaceEditor('edit3', 'rights-edit.php');
						 new Ajax.InPlaceEditor('edit4', 'rights-edit.php');
						 new Ajax.InPlaceEditor('edit5', 'rights-edit.php');
						 new Ajax.InPlaceEditor('edit6', 'rights-edit.php');
						 new Ajax.InPlaceEditor('edit7', 'rights-edit.php');
						</script>
					</table>
				</form>
and then, my rights-edit.php

Code: Select all

$rk = $_GET['value'];
$v = $_GET['v'];

$query = "UPDATE hh_rights SET RightsDesc=$v WHERE RightsKey= '" . $rk . "'";
the problem now is that i cant edit the content on the database when i tried to click to ok that is generated by inplace editor, it will reflect the "Saving.." text and then it disappears, and my database is not updated. im not quite familiar with this.please help me. thank you in advance. :D

Posted: Tue Jun 12, 2007 5:32 pm
by RobertGonzalez
Clean your code, then ask again. Also, this is, I suspect, primarily a Javascript issue, yet there is no mention of the JS code that pushes the updates.