selenin Posted June 7, 2010 Share Posted June 7, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/204134-mysql-select-and-then-unset/ Share on other sites More sharing options...
Muffins Posted June 7, 2010 Share Posted June 7, 2010 Try $sourcesnot = mysql_query("SELECT * FROM pm_player_sources WHERE uniq_id = '".$uniqid."' AND Values IS NOT '0'"); Quote Link to comment https://forums.phpfreaks.com/topic/204134-mysql-select-and-then-unset/#findComment-1069180 Share on other sites More sharing options...
selenin Posted June 7, 2010 Author Share Posted June 7, 2010 Thanks but don't know how to look at the results, did something like that, but is wrong: while($row5 = mysql_fetch_assoc($sourcesnot)) { $id = $row5['uniq_id']; } Quote Link to comment https://forums.phpfreaks.com/topic/204134-mysql-select-and-then-unset/#findComment-1069188 Share on other sites More sharing options...
Muffins Posted June 7, 2010 Share Posted June 7, 2010 while($row5 = mysql_fetch_array($sourcesnot)) { $id = $row5['uniq_id']; //echo $row5['uniq_id']; } Quote Link to comment https://forums.phpfreaks.com/topic/204134-mysql-select-and-then-unset/#findComment-1069190 Share on other sites More sharing options...
selenin Posted June 7, 2010 Author Share Posted June 7, 2010 Gives me the same error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource Quote Link to comment https://forums.phpfreaks.com/topic/204134-mysql-select-and-then-unset/#findComment-1069194 Share on other sites More sharing options...
Muffins Posted June 7, 2010 Share Posted June 7, 2010 Let's back up a second. Is "Values" even a valid Column name? That might be your problem right there. Quote Link to comment https://forums.phpfreaks.com/topic/204134-mysql-select-and-then-unset/#findComment-1069197 Share on other sites More sharing options...
selenin Posted June 7, 2010 Author Share Posted June 7, 2010 No, sorry I'm a beginner, I want all the numbers of all columns, I don't know if it's possible Quote Link to comment https://forums.phpfreaks.com/topic/204134-mysql-select-and-then-unset/#findComment-1069203 Share on other sites More sharing options...
selenin Posted June 7, 2010 Author Share Posted June 7, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/204134-mysql-select-and-then-unset/#findComment-1069211 Share on other sites More sharing options...
Muffins Posted June 7, 2010 Share Posted June 7, 2010 try Values > 0 and see if that works. Quote Link to comment https://forums.phpfreaks.com/topic/204134-mysql-select-and-then-unset/#findComment-1069213 Share on other sites More sharing options...
Rommeo Posted June 7, 2010 Share Posted June 7, 2010 What do you want to use/print ? can you post the result you want ? Quote Link to comment https://forums.phpfreaks.com/topic/204134-mysql-select-and-then-unset/#findComment-1069217 Share on other sites More sharing options...
selenin Posted June 7, 2010 Author Share Posted June 7, 2010 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??? Quote Link to comment https://forums.phpfreaks.com/topic/204134-mysql-select-and-then-unset/#findComment-1069221 Share on other sites More sharing options...
Muffins Posted June 7, 2010 Share Posted June 7, 2010 I meant Values > 0 in your query string. Quote Link to comment https://forums.phpfreaks.com/topic/204134-mysql-select-and-then-unset/#findComment-1069222 Share on other sites More sharing options...
selenin Posted June 7, 2010 Author Share Posted June 7, 2010 No, sorry didn't work Quote Link to comment https://forums.phpfreaks.com/topic/204134-mysql-select-and-then-unset/#findComment-1069223 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.