Page 1 of 1

Edit Info from MySQL database

Posted: Mon Oct 09, 2006 10:27 pm
by dclamp
how do i edit info from mysql database. it was put into the db from a form, and i would like to have it edited in a form aswell.

thanks in advanced!

Posted: Mon Oct 09, 2006 10:45 pm
by ambivalent

Code: Select all

UPDATE table SET field_name_1 = 'form_value_1', field_name_2 = 'form_value_2' WHERE id = '$the_one_i_want_to_edit'
...or something like that.

Posted: Mon Oct 09, 2006 10:54 pm
by dclamp
that makes no sence to me. lol. sorry.

Posted: Mon Oct 09, 2006 11:02 pm
by ambivalent
dclamp wrote:that makes no sence to me. lol. sorry.
In that case, you might want to lol yourself to the relevant MySQL and PHP manuals.

Posted: Tue Oct 10, 2006 6:24 am
by satheshf12000
Hi

I think this is what u need.. rite ??

Code: Select all

<?php
	$host = "localhost";
	$account = "username";
	$pass = "password";
	$dbname = "your_db_name";
	
	$connect=mysql_connect($host,$account,$pass);
	$db = mysql_select_db($dbname);
		
	$quer = "select * from uinfo where email='xxxxxx@gmail.com'";
	$result = mysql_query($quer);
	
	while($row = mysql_fetch_assoc($result))
	{
		$name = $row['name'];
		$email = $row['email'];
	}
	
	
?>

Code: Select all

<form method="post" action="test.php">
Name: <input type="text" name="t1" value="<?php echo $name;?>">
Email: <input type="text" name="t2" value="<?php echo $email;?>">
<input type="submit" value="Submit">
</form>
You should use test.php to update the values from this page.

Posted: Tue Oct 10, 2006 8:58 pm
by dclamp
ambivalent wrote:
dclamp wrote:that makes no sence to me. lol. sorry.
In that case, you might want to lol yourself to the relevant MySQL and PHP manuals.
i am sorry for your post not being clear. try making your post clearer so that i could under stand what you are tring to say. Thanks

Posted: Tue Oct 10, 2006 9:30 pm
by dclamp
i tried that code, and it is not dislaying the contents of the table into the form.

Posted: Wed Oct 11, 2006 5:21 am
by satheshf12000
PHP codes should be on top. Then comes html. Try this way. If not post what have u tried.

Posted: Wed Oct 11, 2006 6:26 am
by onion2k
This problem has been resolved on the forum you advertise in your signature: http://www.vbforums.com/showthread.php?t=432123

Why are you bringing it up here?

Posted: Wed Oct 11, 2006 11:49 pm
by dclamp
onion2k wrote:This problem has been resolved on the forum you advertise in your signature: http://www.vbforums.com/showthread.php?t=432123

Why are you bringing it up here?
Why i brought it here: This is a good place to ask PHP questions, not a VBforum
why it is there: because no one is being helpful here. i found a great help there. kinda weird :-/