Please can someone assist me. I have data stored in mySQL. If i want to allow the user to view this data (say his/her profile information), and at the same time, when it is displayed, it is editable to allow the user to change certain fields and then save.
Hope i make sense.

Thanks

Member Avatar for diafol

Yep, place the data into form fields ready for editing. The submit button can then update changes. If this is too ugly, there are JS solutions that allow you to make inline edits. Just one solution: http://www.appelsiini.net/projects/jeditable/default.html

Thanks for your reply. Will this work with mySQL and where will i put the SQL code?

Member Avatar for diafol

Your text should be generated by mysql in the first place. The inline editor box could have an 'onblur' attribute or 'lose focus' event (known as a 'callback') that calls a php script to update the DB. This is standard Ajax stuff through jQuery. I haven't used this script, but it should be straightforward. There may be a callback function included in the properties of the object.

In the script below we'll see how to use the mysql_query function to retrieve records or rows from our birthdays tableBy the way, if you have time please check Website Design Services

Thanks for your post. I think you forgot to include the script :)

Member Avatar for diafol

@ravzn

They are signature spammers. Their only function is to make you click links in their signatures or message body so that they get some kickback. Worse than scum.

Try to analyze this example.

$query = mysql_query("select * from tbl_name");
while($result=mysql_fetch_array($query))
{
$name = $result;
$age = $result;
$address = $result;
$gender = $result;
}

// now display the result into textbox to allow the user to edit
echo "<form action='save.php' method='post'>";
echo "<input type='text' name='name' value='$name'>";
echo "<input type='text' name='age' value='$age'>";
echo "<input type='text' name='address' value='$address'>";
echo "<input type='text' name='gender' value='$gender'>";
echo "<input type='submit' name='submit' value='Save Changes'>";
echo "</form>";

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.