Forum Moderators: coopster

Message Too Old, No Replies

Update Row

up date certain row

         

Able Net Design

11:38 am on Dec 2, 2003 (gmt 0)

10+ Year Member



ok i can pull the information from the database into forms for the selected user however my update to the database doesn't work. There is no erros but it doesn't update the database at all.

-- Here iS the Code

mysql_connect("localhost","user","pass") or die("Unable to connect to database");

mysql_select_db("ablene33_console") or die("Unable to select database");

//add to database

$query = "UPDATE user SET username='$username', password='$password', firstname='$fname', lastname='$lname', email='$email', domain='$domain', jobstatus='$status', address1='$add1', address2='$add2', postcode='$postcode', state='$state', country='$country' WHERE username = $user";

$result = mysql_query($query);

mysql_close();

header("Location: [site.com...]

[edited by: jatar_k at 4:24 pm (utc) on Dec. 2, 2003]
[edit reason] removed specifics [/edit]

Birdman

11:42 am on Dec 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello,

Look at the very end of the sql.


WHERE username = $user

If the 'username' field is really a name and not an id#, you will need quotes around $user.

You can only omit the quotes if it is an integer.

Able Net Design

12:39 pm on Dec 2, 2003 (gmt 0)

10+ Year Member



nah mate, still didn't work

coopster

12:55 pm on Dec 2, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Exit your script to display the $query statement in your browser. You can then see if anything looks incorrect, or cut and paste the query statement into a command line interface and see what messages MySQL gives you.

$query = "UPDATE...."
exit($query);
$result = .....