I'm trying to fill those two arrays (time2
and text
) from the same query ($result
), however only the first array is filled, and I don't understand why...
Note that I'm invoked from the same query, because ORDER BY RAND ()
functionality is implemented, and when I need to get the values of some array positions, the correct value should appear. And that's why I can't create another identical query.
Is this possible to do?
//Array Time
var time2 = [<?php $title=$_GET["title"];
$result = mysql_query("SELECT tag, round(avg(timecode)) as timecode, group_id
FROM tags
WHERE tags.filename = '".$title."'
GROUP BY group_id, tag
ORDER BY RAND()");
while($row = mysql_fetch_array($result))
{
$timecode = $row['timecode'];
print $timecode;
print ",";
}?>]
//Array Text
var text = [<?php
while($row = mysql_fetch_array($result))
{
$tag = $row['tag'];
print "'";
print $tag;
print "'";
print ",";
}?>]