try $sql = "UPDATE $table_name SET name = '".addslashes($name)."', lname = '".addslashes($lname)."', mobil = '".addslashes($mobil)."', email = '".addslashes($email)."', url = '".addslashes($url)."', WHERE id= $id ";
// mysql needs single quote marks ( ' ) around input values that are not numbers. The addslashes keeps // names like Al "Scar Face" Capone or Nina O'Clock from causing your script to puke. Hugh ----- Original Message ----- From: "Jason Wong" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, December 04, 2002 9:52 PM Subject: Re: [PHP] Struggling with code > 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."); > > > > ?> > > How about NOT masking the error message by using mysql_query(), instead of > @mysql_query(). And instead of using die(), use echo mysql_error(). > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > A rolling stone gathers no moss. > -- Publilius Syrus > */ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php