Page 1 of 1

I think i need UPDATE SYNTAX not sure.. read for deital

Posted: Thu Jun 05, 2003 4:38 pm
by I3lade
Ok, in my site theres a profile thing, like in these boards edit your profile. It's simple right now since im new to php, but i tried using a code to make it so they can update thier profile. Instead it inserets the info they submit into a new row in my table. Do i need to use update? If so how?

Posted: Thu Jun 05, 2003 4:40 pm
by delorian
If you are using MySQL try reading documentation on http://www.mysql.org first, it's the best thing to do.

Posted: Thu Jun 05, 2003 4:41 pm
by I3lade
Yeah i tried that, its kinda confusing, its easier when u ask someone see a example of code or something to me, is there anyone who can help with update if i even need that?

Posted: Thu Jun 05, 2003 4:46 pm
by I3lade
Dosn't update look something like

Code: Select all

<? UPDATE table_name SET column1=value1, column2=value2, ..., columnN=valueN &#1111;WHERE feild=value] ?>
I think thats it, but don't know how to set it up to use it in my case, which is making a profile setup. I know the html session_register ect but not the update. I think i know what goes in column not value though.

Posted: Thu Jun 05, 2003 4:50 pm
by I3lade
:( Isnt there anyone who can help me?

Posted: Thu Jun 05, 2003 4:56 pm
by delorian
їquote="I3lade"]Yeah i tried that, its kinda confusing, its easier when u ask someone see a example of code or something to me, is there anyone who can help with update if i even need that?ї/quote]

Yes it is easier, but it is wiser to do it by yourself. You will learn faster, and you'll have more pleasure when you achieve something, but....

If you want to update the database table you must use something like this:

їcode]
// for mysql

$bp = mysql_connect("localhost","login","password");
mysql_select_db("database",$bp);
mysql_query("UPDATE sth SET sth=sth, asdf=asdf, asdf=asdf,....",$bp);

ї/code]

But that's VERY simple example and HELL out of a good php script.

Posted: Thu Jun 05, 2003 4:58 pm
by I3lade
Whats the sth=sth, asdf=asdf for? What do i replace with it my table feild names?

Posted: Thu Jun 05, 2003 5:00 pm
by delorian
I3lade wrote:Whats the sth=sth, asdf=asdf for? What do i replace with it my table feild names?
Right, come on! You don't want to get everything plain and easy, do you?

Posted: Thu Jun 05, 2003 5:02 pm
by I3lade
lol i know one of them is the field name im not sure what the other is, becuae i want what they put into an html form to inseret into the row.. not what i want to put..

Posted: Thu Jun 05, 2003 5:07 pm
by I3lade
So something like:

Code: Select all

$bp = mysql_connect("localhost","bladegames","****"); 
mysql_select_db("bladegames,$bp); 
mysql_query("UPDATE members SET profile=user, phob=user, $bp);
One thing i dont get... whats the $bp for?

Posted: Thu Jun 05, 2003 5:13 pm
by delorian
I3lade wrote:So something like:

Code: Select all

$bp = mysql_connect("localhost","bladegames","****"); 
mysql_select_db("bladegames,$bp); 
mysql_query("UPDATE members SET profile=user, phob=user, $bp);
One thing i dont get... whats the $bp for?
See mysql_query descirption in php manual.

-------------------
Of course the code would look something like this:

Code: Select all

$bp = mysql_connect("localhost","bladegames","****"); 
mysql_select_db("bladegames",$bp); 
mysql_query("UPDATE members SET profile=user, phob=user WHERE here_you_descibe_what_record_has_to_be_updated", $bp);
Please, read the manual.