Jump to content

Archived

This topic is now archived and is closed to further replies.

winnij

Generate variable name

Recommended Posts

Hello,

For a website php and mysql are used. A recordset contains names and a filelocation.
Each name an each fillelocation needs to become a variable. I would achieve that by a for loop, see example.

for($i=0; $totalRows_RS-1 ; $i++){
($tab +($i+1)) = $row_RS['name'];
($link + ($i+1)) = $row_RS['location'];
}

PHP returns Parse error: parse error, unexpected '='..

Has anyone an idea to solve this problem?

Share this post


Link to post
Share on other sites
because you're using the wrong syntax

do this

[code]${"tab".$i++} = $row_RS['name'];[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.