that's exactly what i said in first.
$query2 = "SELECT qty FROM cart"; // this query only return 1 item in a row.
$result = mysql_query($query2);
$row = mysql_fetch_array($result);
$query4 = "UPDATE CD_data SET stock_level=stock_level-$row[1] WHERE Item_code='$row2[1]'";
mysql_query($query4);
echo ("$row[1]");
there is nothing in $row[1], only qty.
if you means there are 3 result returned by your query, then
you'll have to loop 3 times
that's the purpose of while($row=mysql_fetch_array($result)) { ...
it will fetch the first row of the result in $row[0] (3 if i understood well)
do your update with this value .
then it will fetch next row ... $row[0] will now have the value of the second row of the result (here 2)
will do the same as with the 3 value then fetch again.
again $row[0] will have value=2
then fetch again : no more values to fetch, so end of loop.