Jump to content

Mysql select and then unset


selenin

Recommended Posts

Hello, I try things these are too difficult for me. First I want to select numbers from my database, this is my code:

 

$sourcesnot = mysql_query("SELECT * FROM pm_player_sources WHERE uniq_id = '".$uniqid."' AND Values != '0'");

 

So I want to get the numbers where is not null, don't know if exists Values and after I want to unset these numbers (keys) from another array

 

Link to comment
https://forums.phpfreaks.com/topic/204134-mysql-select-and-then-unset/
Share on other sites

No I made it like that

 

	$sourcesnot = mysql_query("SELECT * FROM pm_player_sources WHERE uniq_id = '".$uniqid."'");
//$row4 = mysql_fetch_array( $sourcesnot );
while($row5 = mysql_fetch_array($sourcesnot))
{
	$id = $row5;
	var_dump($id);

}

 

and I get this

 

array(12) {

  [0]=>

  string(9) "33d5e5c94"

  ["uniq_id"]=>

  string(9) "33d5e5c94"

  [1]=>

  string(1) "4"

  ["novamov"]=>

  string(1) "4"

  [2]=>

  string(1) "0"

  ["movshare"]=>

  string(1) "0"

  [3]=>

  string(1) "6"

  ["videoweed"]=>

  string(1) "6"

  [4]=>

  string(1) "0"

  ["stagevu"]=>

  string(1) "0"

  [5]=>

  string(1) "0"

  ["megavideo"]=>

  string(1) "0"

}

 

Now I want always only the numbers, like here 4 and 6 always where is not a 0, and these numbers I want to unset as key of an array

I'm back now I try it like that

 

	$sourcesnot = mysql_query("SELECT megavideo, novamov, videoweed, movshare, stagevu FROM pm_player_sources WHERE uniq_id = '".$uniqid."'");

while($row5 = mysql_fetch_array($sourcesnot))
{
	$id = $row5;
	//var_dump($id);
	foreach ($id as $k => $v) {
		if ($v > 0){
			$sourcenot = $v;
			var_dump($v);
		}
    
}

 

and I get this

 

string(1) "4"

string(1) "4"

string(1) "6"

string(1) "6"

 

but why I do get two times 4 and two 6???

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.