Array next does not work

The following code works

[php]if ($_GET[id]) {
while ($sel = mysql_fetch_array($selectString, MYSQL_ASSOC)) {
print(current($sel));
}
}[/php]

This does not:

[php]if ($_GET[id]) {
while ($sel = mysql_fetch_array($selectString, MYSQL_ASSOC)) {
if(next($sel)){
print(next($sel));
}
}
}[/php]

Any ideas why???

im not sure what exacly you are trying to do but you could count the elements of the array and then loop through the elements

Basically, I need to, when a particular condition is met, move to the next record of the array. The code I put in my post was just to help me get the “next” function working.

Thanks for asking

Worked it out.

What I actually needed was mysql_fetch_row to move to the next row of the array.

“next” moves to the next entity within the row.

Thanks for trying to help, but my explanation of the problem was not very good.

Sponsor our Newsletter | Privacy Policy | Terms of Service