Ik heb een array, verkregen uit een tabel.
Nu wil ik de tabel gaan aanpassen door een waarde uit de array te vergelijken met die uit de tabel.
De array heeft deze structuur:

Array
(
    [0] => Array
        (
            [nf] => AUS
            [combinationID] => 108
            [horseFEIid] => 102VN37
            [personFEIid] => 10009036
            [compNumber] => 0
            [is_nc] => No
            [is_waitingList] => No
            [combinationLocked] => No
            [dateAdded] => 2014-09-18 14:14:58
            [dateEdit] => 2014-09-16 14:23:47
        )


    [1] => Array
        (
            [nf] => AUT
            [combinationID] => 20
            [horseFEIid] => 102VP001
            [personFEIid] => 10009036
            [compNumber] => 0
            [is_nc] => No
            [is_waitingList] => No
            [combinationLocked] => No
            [dateAdded] => 2014-09-18 14:14:58
            [dateEdit] => 2014-09-16 14:23:47
        )
Etc

    }

Onderstaande code gebruik ik om dit te doen:

$compStart = 200;
$x = 0;
while ($x < $numberComb)
    {
    echo "UPDATE `2010Combination` 
          SET `compNumber` = '".$compStart."' ,`combinationLocked` = 'Yes' 
          WHERE `2010Combination`.`combinationID` = `".$arrAll[$x][combinationID]."` 
          ";    
    $compStart++;
    echo $x."<BR/>";
    $x++;
    }

De foutmelding die ik krijg is Notice: Use of undefined constant combinationID - assumed 'combinationID'
in deze regel: WHERE `2010Combination`.`combinationID` = `".$arrAll[$x][combinationID]."`

De vraag is of ik de array wel geod uitlees?
Wat geef je echo als resultaat?
Daarnaast: haal die ` overal weg. Niet nodig.
Je bent de quotes vergeten op regel 7 helemaal achterin. ($arrAll[$x][combinationID])

Het kan alleen zijn:

$arrAll[$x][$combinationID]

of

$arrAll[$x]['combinationID'] // deze dus lijkt mij
> Het kan alleen zijn:

Je vergeet nog een variant ;-)

"$arrAll[$x][combinationID]"

alhoewel die binnen de ondoorgrondelijke ontwerpprincipes van PHP valt...
@Frank, dat was het. Dit probleem ook weeer opgelost.

Reageren