Page 1 of 1

Variable index in for() loop expression in php

Posted: 08 Feb 2017, 07:17
by JanMolendijk
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

Variable index in for() loop expression in php

Posted: 08 Feb 2017, 11:48
by Admin
You can add $user['id'] in for expression like in this code:

Code: Select all

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

Variable index in for() loop expression in php

Posted: 08 Feb 2017, 12:15
by JanMolendijk
i tried many things but i get no results