$conn = odbc_connect('Kassa','','');
$row = odbc_connect('Kassa','','');
These two do exacly the same, and the 2nd is also in a loop which would, if it worked, result in reopening the connection over and over.
Something like this, then you open and close once.
<?php
error_reporting(E_ALL);
$conn = odbc_connect('Kassa','','');
$sql = "SELECT Artikelnr,Kopplat,Antal FROM Artpack";
$rs = odbc_exec($conn,$sql);
$packages = null;
while(odbc_fetch_row($rs)){
$packName = odbc_result($rs,"Kopplat");
$artNr = odbc_result($rs,"Artikelnr");
$artNum = doubleval(odbc_result($rs,"Antal"));
$art = "SELECT Artikelnr,InkopsPris FROM Lager WHERE (Artikelnr LIKE {$artNr})";
$rart = odbc_exec($conn,$art); // use $conn here as well
if($rart === FALSE){ /* errors 'n stuff */}
odbc_fetch_row($rart);
$artCost = doubleval(odbc_result($artRow,"InkopsPris"));
$packages[$packName] += ($artCost*$artNum);
$count++;
}
odbc_close($conn);
print_r($packages);
?>
Also instead of having the 2nd SELECT within the loop, what you tried to look at JOINS to see if you can get away with one SELECT?