try this:

$db = mysql_connect(host,uid,pwd);
if($act=="ADD"){
$sql="INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp')";
$res = mysql_db_query($dbname,$sql,$db);
  if(!$res){
  echo("Unable to add part.");
  mysql_close($db);
  exit();
  }
}

you didn't specify $dbname

-----Original Message-----
From: Robert [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 25, 2001 3:07 PM
To: Darryl Friesen; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] insert into mysql


It still didn't work.
just says unable to add part
$db = mysql_connect("tech2000", "wwwguest", "guest");

----- Original Message -----
From: "Darryl Friesen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 25, 2001 2:02 PM
Subject: Re: [PHP-DB] insert into mysql


>
> > //--------------------------- Add
part ----------------------------------
> > if($act=="ADD"){
> > $sql="INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp'),$db";
> > if(! @mysql_db_query("$sql")){
> >    echo("Unable to add part."); mysql_close($db);exit();} }
> >
> > Why does this not work?
> >
>
> You're INSERT query is wrong.  Take the ',$db' off the end.
>
> $sql = "INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp')";
>
>
> - Darryl
>
>  ----------------------------------------------------------------------
>   Darryl Friesen, B.Sc., Programmer/Analyst    [EMAIL PROTECTED]
>   Education & Research Technology Services,     http://gollum.usask.ca/
>   Department of Computing Services,
>   University of Saskatchewan
>  ----------------------------------------------------------------------
>   "Go not to the Elves for counsel, for they will say both no and yes"
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to