Get rid of the double quotes around your variables so: $sql = "UPDATE $table_name SET name='$name', lname='$lname', mobil='$mobil' etc etc etc
Cheers! Rick "Sir my concern is not whether God is on our side. My great concern is to be on God's side." - Abraham Lincoln > On Thursday 05 December 2002 13:24, Ben C. wrote: > I am struggling with the code below. I keep getting the error "Couldn't > execute query". Please help me out, let me know where I am going wrong. > > <? > > $db_name = "db1"; > $table_name = "user"; > > $connection = @mysql_connect("localhost", "user", "password") or > die("Couldn't connect."); > > $db = @mysql_select_db($db_name, $connection) or die("Couldn't select > database."); > > $sql = "UPDATE $table_name > SET > name = \"$name\", > lname = \"$lname\", > mobil = \"$mobil\", > email = \"$email\", > url = \"$url\", > WHERE id= \"$id\" > "; > > $result = @mysql_query($sql,$connection) or die("Couldn't execute > query."); > > ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php