loading a multi-dimensional array?
Posted: Thu Dec 12, 2002 9:40 pm
for($x = 1; $x <= $num_rows; $x++)
{
$sql = "select actions from pjstatus where pjid=".$x." order by date desc limit 1";
$sql_res = mysql_query($sql);
while($row_2 = mysql_fetch_row($sql_res))
{
$desc[] = $row_2;
}
}
this loads my array just fine. But what if I want to load the value of '$x' in the position for which it cooresponds to the action select from the query? How would I do that? Example:
right now the code does the following:
select actions where pjid='x'
desc[0][0] = action
desc[1][0] = action
desc[2][0] = action
etc...
what I want is:
select actions where pjid='x'
desc[0][0] = actions & desc[0][1] = x
desc[1][0] = actions & desc[1][1] = x
desc[2][0] = actions & desc[2][1] = x
etc...
How do I accomplish that? Is it possible?
{
$sql = "select actions from pjstatus where pjid=".$x." order by date desc limit 1";
$sql_res = mysql_query($sql);
while($row_2 = mysql_fetch_row($sql_res))
{
$desc[] = $row_2;
}
}
this loads my array just fine. But what if I want to load the value of '$x' in the position for which it cooresponds to the action select from the query? How would I do that? Example:
right now the code does the following:
select actions where pjid='x'
desc[0][0] = action
desc[1][0] = action
desc[2][0] = action
etc...
what I want is:
select actions where pjid='x'
desc[0][0] = actions & desc[0][1] = x
desc[1][0] = actions & desc[1][1] = x
desc[2][0] = actions & desc[2][1] = x
etc...
How do I accomplish that? Is it possible?