Below code IS NOT working
$ID=2;
mysql_connect($localhost,$username,$password);
mysql_select_db(productlist) or die( "Unable to select database");
$query='SELECT * FROM HolisticSerums where ProductID =$ID' ;
$result=mysql_query($query);
$array = mysql_fetch_assoc($result);
echo $array['Size'];
mysql_close();
but when i use 2 instead of $ID it is working
//$ID=2;
mysql_connect($localhost,$username,$password);
mysql_select_db(productlist) or die( "Unable to select database");
$query='SELECT * FROM HolisticSerums where ProductID =2' ;
$result=mysql_query($query);
$array = mysql_fetch_assoc($result);
echo $array['Size'];
mysql_close();
first please tell me how to typecast integer of PHP to int of database? can any one help me what is the problem in 1st case.. ?? ProductID column is INT in database