Array problem

Discussion in 'PHP' started by selen, Jun 8, 2010.

  1. #1
    Hello, I try now to learn arrays, my code:

    	$sourcesnot = mysql_query("SELECT megavideo, novamov, videoweed, movshare, stagevu FROM pm_player_sources WHERE uniq_id = '".$uniqid."'");
    	
    	while($row5 = mysql_fetch_assoc($sourcesnot))
    	{
    		$id = $row5;
    		
    		foreach ($id as $k => $v ) {
    			if ($v > 0){
    				
    				
    				
    				
    				$arr = array($v);
                    
    				var_dump($arr);
    				
    			}
        
             }
    		
    	}
    PHP:
    var_dump($arr) gives me this result:

    Now I have two arrays, but I need only one with 4 and 6
     
    selen, Jun 8, 2010 IP
  2. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
  3. selen

    selen Well-Known Member

    Messages:
    525
    Likes Received:
    7
    Best Answers:
    1
    Trophy Points:
    118
    #3
    Don't get it and there can be as well more than two, that's just an example these two
     
    selen, Jun 8, 2010 IP
  4. mehmetm

    mehmetm Well-Known Member

    Messages:
    134
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #4
    is that what u want ?

    
    <?php
    
    $sourcesnot = mysql_query("SELECT megavideo, novamov, videoweed, movshare, stagevu FROM pm_player_sources WHERE uniq_id = '".$uniqid."'");
    
    	$arr = array();
        
        while($row5 = mysql_fetch_assoc($sourcesnot)) {
    	
            foreach($row5 as $k => $v):
    		
    			$arr[][$k] = $v;
    		
    		endforeach;
    
        }
    	
    	var_dump($arr);
    
    ?>
    
    PHP:
     
    mehmetm, Jun 8, 2010 IP