date & decimal variables appear as zeros

Iam a newbie to php. Iam builing ainventory control system. My problem is with date(type = date) and quantity(decimal). When i inserting some values for these categories they show and store as zeros. Hope u guys will help me to debug this. thanks

This is my addchemical_save.php page.

[php]<?php
session_start();
include(“config.php”);
$generalname = mysql_real_escape_string($_POST[‘generalname’]);
$Scientificname = mysql_real_escape_string($_POST[‘Scientificname’]);
$quantity = mysql_real_escape_string($_POST[‘quantity’]);
$type = mysql_real_escape_string($_POST[‘type’]);
$unit = mysql_real_escape_string($_POST[‘unit’]);
$date = mysql_real_escape_string($_POST[‘date’]);

$qry_add = "INSERT INTO chemical
(generalname, Scientificname, quantity, type, unit, date )
VALUES (’$generalname’, ‘$Scientificname’, ‘quantity’, ‘$type’, ‘$unit’,’$date’) ";

$count = mysql_query(“SELECT COUNT(chemicalname) FROM chemical WHERE chemical name=’$generalname’”);
if($count==1)
{
echo " Duplicate Entry. Please Verify Chemical name ";
}
else
{

		   if($result=mysql_query($qry_add))
		   {
		     echo  '<script language="javascript">';
             echo  'alert("you have successfully added one Chemical!" );';
             echo  '</script>';   
		   }

		   else
		  {
		   echo "<br><font color=red size=+1 >Problem in Adding !</font>" ;
		   echo "ERROR - unable to add new chemical!<br>";
           $SQLError =  "SQL ERROR: ".mysql_errno().".  ".mysql_error()."<BR><BR>";
           echo "$SQLError";
           mysql_close();
	
		  }
		
		}

?>[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service