you can also do this to save room without having to create $varname:
${"id".$num} = "some text";
Jordan
On Aug 29, 2005, at 12:10 AM, Micah Stevens wrote:
Hi Chris,
You can use variable variables.. like this:
$num = 2
$varname = "id".$num;
$$varname = "id2 is stored here!";
It's in the docs in the variables section..
HTH,
-Micah
On Sunday 28 August 2005 11:45 pm, Chris Payne wrote:
Hi there everyone,
I have the following code:
while ($row = mysql_fetch_array($sql_result)) {
$id = $row["id"];
$video_link = $row["video_link"];
$video_thumbnail = $row["video_thumbname"];
$video_title = $row["video_title"];
$video_description = $row["video_description"];
};
Now I’ll be shifting through my MySQL array 6 items at a time,
what I’d
LIKE to be able to do is store each item in a number string on
each pass.
In other words, the first loop would see $id being called
something like
$id1, the second pass in the loop it would be $id2 and so on.
I THOUGHT I could do this by putting a $count ++ in the loop and
then doing
something like $id$count or something like $id.$count but neither
worked,
this may sound odd but I REALLY need to be able to do this so how
can I
name a string that has to contain the data from a row successively
higher
on each loop so that it doesn’t overwrite the data on the previous
loop?
I have 6 items on the page so I can hardcode <?=$id1?> for item 1 and
<?=$id2?> for item 2 etc …. But with the layout of the page being
able to
do it THIS way would be MUCH better than having to set the table
itself up
to handle it.
Any help on this (Probably very easy) but annoying problem would
be REALLY
appreciated ;-)
Chris
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php