Edit Info from MySQL database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
dclamp
Forum Commoner
Posts: 35
Joined: Sun Sep 17, 2006 10:05 am

Edit Info from MySQL database

Post 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!
User avatar
ambivalent
Forum Contributor
Posts: 173
Joined: Thu Apr 14, 2005 8:58 pm
Location: Toronto, ON

Post 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.
User avatar
dclamp
Forum Commoner
Posts: 35
Joined: Sun Sep 17, 2006 10:05 am

Post by dclamp »

that makes no sence to me. lol. sorry.
User avatar
ambivalent
Forum Contributor
Posts: 173
Joined: Thu Apr 14, 2005 8:58 pm
Location: Toronto, ON

Post 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.
satheshf12000
Forum Commoner
Posts: 25
Joined: Mon Sep 04, 2006 5:38 pm

Post 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.
User avatar
dclamp
Forum Commoner
Posts: 35
Joined: Sun Sep 17, 2006 10:05 am

Post 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
User avatar
dclamp
Forum Commoner
Posts: 35
Joined: Sun Sep 17, 2006 10:05 am

Post by dclamp »

i tried that code, and it is not dislaying the contents of the table into the form.
satheshf12000
Forum Commoner
Posts: 25
Joined: Mon Sep 04, 2006 5:38 pm

Post by satheshf12000 »

PHP codes should be on top. Then comes html. Try this way. If not post what have u tried.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post 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?
User avatar
dclamp
Forum Commoner
Posts: 35
Joined: Sun Sep 17, 2006 10:05 am

Post 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 :-/
Post Reply