I don't know what I'm doing wrong, but it won't update ever. I know all the variables work because I've posted them in several places, I've echoed them out, copied that and put it into the query and it's worked, and I've copied it to an entirely different page and it's worked. The one page I need it to work on, it decides not to work. I've gone through and checked the code several times as well, but for some reason it's deciding not to work. I changed the code to two lines, because I thought there might have been a problem on one line.

I've read through many posts and I've tried different things, but I'm not getting any results :(

$u = "UPDATE Profile SET Image = '$f ' WHERE Forum = '$p'";


mysql_query($u, mysql_connect(host, username, pass));

Recommended Answers

All 4 Replies

check your database field names Forum,Image . is it correct or not.

The mysql_query does not know what database to perform the action on.

$link = mysql_connect('host', 'username', 'pass');
mysql_select_db('database');
$u = "UPDATE Profile SET Image = '$f' WHERE Forum = '$p'";
mysql_query($u, $link);
commented: well said ;) +1

you need to connect select database then query, in that order for thing to work.
although if you are using dreamweaver templates sometimes it meses with things.

$conn = mysql_connect('host', 'user', 'pass');
mysql_select_db('database_name');
$sql = "UPDATE Profile SET Image = '$f' WHERE Forum = '$p'";
mysql_query($sql, $conn);

Hope this helps :)

you forgot to select database. use mysql_select_db('database_name') for select database

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.