Jump to content
php.lv forumi

Array problēma


sandrulis

Recommended Posts

Sveiki, man kārtējā problēma šoreiz ar array:

 

ievadod šo kodu:

$result=mysql_query("SELECT * FROM articles");
while($row = mysql_fetch_array($result))
{
 $a = array(date("d",$row['time']) => array("links",'id'));
 print_r($a);
}

 

iegūstu:

Array ( [01] => Array ( [0] => links [1] => id ) )

Array ( [13] => Array ( [0] => links [1] => id ) )

Array ( [30] => Array ( [0] => links [1] => id ) )

 

Bet kā lai dabōnu šo te visu zem viena array (kā piemērā):

 

Array ( [01] => Array ( [0] => link [1] => id ) [13] => Array ( [0] => links [1] => id ) [30] => Array ( [0] => links [1] => id ) )

 

Bet ja ievadu šo kodu:

$result=mysql_query("SELECT * FROM articles");
while($row = mysql_fetch_array($result))
{
 $a[] = array(date("d",$row['time']) => array("links",'id'));

}
print_r($a);

 

Tad viss aiziet grīstē.

 

Ceru ka sapratāt ko vēlos un ceru ka varat palīdzēt

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...