Variable index in for() loop expression in php

User avatar
JanMolendijk
Posts: 115
Location: Holland Rotterdam

Variable index in for() loop expression in php

Dear admin i try for few hours to find out how i can get an id into my code

Code: Select all

<?php for($i = (0); $i<sizeof($i);$i++){ ?>
- $i = (0); the 0 is my problem but i getting errors
when i place: ($i = ('. $users['id'] .');

i tried also this code give also errors

Code: Select all

<?php for($i = ('. $users[id] .'); $i<sizeof($i);$i++){ ?>
& i tried this code gives also error:

Code: Select all

Notice: Use of undefined constant id - assumed 'id' in C:\xampp\htdocs\Rating\index1.php

Code: Select all

<?php for($i = ($users[id]); $i<sizeof($i);$i++){ ?>
I hope i`m understanble because my English

Admin
You can add $user['id'] in for expression like in this code:

Code: Select all

for($i = $users['id']; $i<sizeof($i);$i++)

JanMolendijk
i tried many things but i get no results

Similar Topics