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
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

Link to comment
Share on other sites

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???

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • 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.