I am trying to update the price of my product based on ID. ID and price both are string.My code is
for($i=1;$i<=$rows;$i++)
{
$flag=0;
$result = mysqli_query($con,"SELECT id FROM `TABLE 1` ");
while($row = mysqli_fetch_array($result))
{
$v=strval($cols[$i][0]);
if(strcmp($row['id'],$v)==0)//id exists in database=> update
{
mysqli_query($con,"UPDATE `TABLE 1` SET `price`=".$cols[$i][4]." WHERE `id`=$v");
//echo $cols[$i][0];
$flag=1;
}
}
Where cols[][] is my multidimensional array. It update the record correctly whose type is integer but not those are String.But product with id 101-1 not updated correctly.Where I am missing?