Re: insert in mysql

From: Date: Thu, 25 Jan 2001 22:42:06 +0000
Subject: Re: insert in mysql
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-6194@lists.php.net to get a copy of this message
on 1/25/01 1:12 PM, Robert (rarg@bruinel.com) wrote: > Still not working right though > > if($act=="ADD"){ > $sql="INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp')"; > if(! mysql_query('$sql')){echo("Unable to add > part.");mysql_close($db);exit();} > } Why the single quotes around $sql. It's a string so you shouldn't have to quote it at all. if (!mysql_query($sql)) {echo 'Unable to add part!'; } ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Paul Burney Webmaster and Internet Developer Educational Technology Unit Graduate School of Education and Information Studies University of California, Los Angeles (310) 825-8365 <webmaster@gseis.ucla.edu> <http://www.gseis.ucla.edu/> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

« previous php.db (#6194) next »