OK, I'm confused how to write an update for this simple app I'm developing locally to learn more about db interactions.
I have an "edit" page, which is populated from the db and lists up to 9 user links, so something like:
<input type="text" name="link1" value="http://www.yahoo.com">
<input type="text" name="link2" value="http://www.google.com">
<input type="text" name="link3" value="http://www.amazon.com">
<input type="text" name="link4" value="">
<input type="text" name="link5" value="">
<input type="text" name="link6" value="">
<input type="text" name="link7" value="">
<input type="text" name="link8" value="">
<input type="text" name="link9" value="">
<input type="submit" name="submitted" value="update">
My links table is just 2 columns and looks like:
How do I go about writing an UPDATE query for, say, editing the 3rd link and adding a 4th? I have it stuck in my head that I need 9 link columns in my db.Code:user_id linkurl 2 http://www.yahoo.com 2 http://www.google.com 2 http://www.amazon.com
I also have on this same page a section for the user's personal info and I can update that easily with a query like:
Code:$query = "UPDATE users SET first_name='$firstname', last_name='$lastname', email='$email', state='$state'" if($newpass1){ $query .= ", pass=md5('$newpass1')"; } $query .= " WHERE user_id = {$_SESSION['user_id']}";







Bookmarks