Re: Struggling with code

From: Date: Thu, 05 Dec 2002 05:44:51 +0000
Subject: Re: Struggling with code
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-127100@lists.php.net to get a copy of this message
Hi, Thursday, December 5, 2002, 3:24:15 PM, you wrote: BC> I am struggling with the code below. I keep getting the error "Couldn't BC> execute query". Please help me out, let me know where I am going wrong. BC> <? BC> $db_name = "db1"; BC> $table_name = "user"; BC> $connection = @mysql_connect("localhost", "user", "password") BC> or BC> die("Couldn't connect."); BC> $db = @mysql_select_db($db_name, $connection) or die("Couldn't select BC> database."); BC> $sql = "UPDATE $table_name BC> SET BC> name = \"$name\", BC> lname = \"$lname\", BC> mobil = \"$mobil\", BC> email = \"$email\", BC> url = \"$url\", BC> WHERE id= \"$id\" BC> "; BC> $result = @mysql_query($sql,$connection) or die("Couldn't execute query."); ?>> BC> -------------------------------------------------------------------------- BC> The content of this email message and any attachments are confidential and BC> may be legally privileged, intended solely for the addressee. If you are BC> not the intended recipient, be advised that any use, dissemination, BC> distribution, or copying of this e-mail is strictly prohibited. If you BC> receive this message in error, please notify the sender immediately by reply BC> email and destroy the message and its attachments. do this to debug your code: $result = @mysql_query($sql,$connection) or die("Couldn't execute query $sql<br>".mysql_error()); -- regards, Tom

« previous php.general (#127100) next »