Jump to content

karimali831

Members
  • Posts

    436
  • Joined

  • Last visited

Everything posted by karimali831

  1. Thanks again but query failed Have I done something wrong? safe_query("INSERT INTO ".PREFIX."cup_matches (clan1, clan2) (SELECT a.clan1, b.clan2 FROM ".PREFIX."cup_matches a, ".PREFIX."cup_matches b WHERE a.clan2 != b.clan2 AND matchno='$ID' AND ($get_groups)");
  2. Uses same table, now I have done it manually. Surely this brings some understanding: Don't relate the first attatchment to this one. * Green is how it was. * Red are the 12 rows I inserted manually, as you can see it matches every combination (clan1, clan2.) [attachment deleted by admin]
  3. INSERT INTO table (SELECT a.fieldclan1Id, b.fieldclan2id FROM clan1table a, clan2table b) From table 1 and 2 ? My attatchment shows only one table. Sorry, not sure why no one understands what I'm trying to do... I will just manually do it then you should understand.
  4. You can see the table structure in my first post - attatchment. Can you base my structure on your select query then? SELECT a.ClanMember AS Clan1Member, b.ClanMember as Clan2Member FROM Members a CROSS JOIN Members b WHERE a.Clan = 2620 AND b.Clan = 2619 Then I can see what I can do and get back to you if I need further help. Thanks again.
  5. Yes but I need to insert the rows. Go to http://cupaddon.com/index.php?site=groups&laddID=1 and look under group b I need the INSERT query to insert 12 rows so that : test8 is also against test7, test4, test16 test5 is also against test13, test4, test16 test1 is also against test13, test7, test16 test15 is also against test4, test7, test13
  6. Hello! I want to use insert rows into the table so that every user in clan1 matches clan2. Take a look at the attatchment: At the moment you see: clan1: 2620 2617 2609 2629 clan2: 2627 2619 2612 2630 What I need is INSERT INTO() query that will insert multiple rows so that so that every user in clan1 is competiting against every user in clan2. e.g for user 2620, add 3 rows. new row 1 clan1: 2620 new row 1 clan2: 2619 new row 2 clan1: 2620 new row 2 clan2: 2612 new row 1 clan1: 2620 new row 1 clan2: 2630 as there are 4 users in clan1 in total, it should insert 12 rows? Hope you understand. Thanks for any help, really need this one. [attachment deleted by admin]
  7. Thank you EDIT Should it be 0,8 as there are 8 letters?
  8. Hi, I want to pick out a random letter from a to h. How can I do this? So everytime the page re-loads, a random letter (range a-h) will show. Thanks alot for any help.
  9. Please somone I really hate planes, long flight time and I'm going to be bored. PHP will keep my occupied, thanks.
  10. Hi Thanks for that. I have installed this fine, I am able to run http://localhost and http://localhost/phpmyadmin but not run any .php files? I create the php files in /wamp/www/ but I get "Server not found" error. The URL is like: http://localhost/test.php (don't work)
  11. Hi all, I'm close to flying that will take many hours where I want to get to without internet access so I want to be able to use php/phpmyadmin on Windows 7? A friend told me there is a free software for this, can't remember the name though.
  12. I solved the time issue but posting timestamps to the database instead of the actual time and date format. DavidAM: max(); worked fine, thanks alot.
  13. Hmm ok. My other question is can I convert for example this time format : Tuesday Aug 31st 2010 @ 2:04 pm to a timestamp?
  14. Hi I'm trying to find the max value in 3 columns, new_date, reply_date and finalized_date in my table: $test = safe_query("SELECT MAX(new_date) FROM (SELECT new_date AS new_date FROM ".PREFIX."cup_challenges UNION SELECT reply_date FROM ".PREFIX."cup_challenges UNION SELECT finalized_date FROM ".PREFIX."cup_challenges) AS maxval"); Did some research and have no idea what is wrong/if the above is correct? The page breaks below this code.
  15. My thought, I had to use your function inside the loop: $getchallenges = safe_query("SELECT * FROM ".PREFIX."cup_challenges WHERE ladID='$ladID'"); while($ds=mysql_fetch_array($getchallenges)) { if($ds['new_date']) $new_date = $ds['new_date']; if($ds['reply_date']) $reply_date = $ds['reply_date']; if($ds['finalized_date']) $finalized_date = $ds['finalized_date']; $getMin = array($new_date,$reply_date,$finalized_date); $getMin = min(array_filter($getMin)); return returnTime($getMin); } Thanks again very much for your help!
  16. Thanks for your reply. Now I get something, but I believe it picked out the incorrect value. I echo $getMin but it gets: 1282971660 (highest in new_date column) max is: 1282971720 $getMin needs to have min: 1282948140 $getchallenges = safe_query("SELECT * FROM ".PREFIX."cup_challenges WHERE ladID='$ladID'"); while($ds=mysql_fetch_array($getchallenges)) { if($ds['new_date']) $new_date = $ds['new_date']; if($ds['reply_date']) $reply_date = $ds['reply_date']; if($ds['finalized_date']) $finalized_date = $ds['finalized_date']; $getMin = array($new_date,$reply_date,$finalized_date); $getMin = min(array_filter($getMin)); }echo 'getmin = '.$getMin.''; return returnTime($getMin);
  17. Sure! echo: echo '<br>newdate = '.$ds['new_date'].''; echo '<br>replydate = '.$ds['reply_date'].''; echo '<br>finalized date = '.$ds['finalized_date'].''; Output: newdate = 1282948140 replydate = 0 finalized date = 0 newdate = 1282955160 replydate = 0 finalized date = 0 newdate = 1282959480 replydate = 0 finalized date = 0 newdate = 1282960620 replydate = 0 finalized date = 0 newdate = 1282971660 replydate = 1282971720 finalized date = 01282971720 According to the output, I want it to return returnTime('1282948140'); (lowest timestamp except 0) Thanks again
  18. Thanks! works fine with php max $last_played = max($gc['new_date'],$gc['reply_date'],$gc['finalized_date']); I also want to use it for php min excluding 0 values to find the longest idler: $getchallenges = safe_query("SELECT * FROM ".PREFIX."cup_challenges WHERE ladID='$ladID'"); while($ds=mysql_fetch_array($getchallenges)) { if($ds['new_date']) $new_date = $ds['new_date']; if($ds['reply_date']) $reply_date = $ds['reply_date']; if($ds['finalized_date']) $finalized_date = $ds['finalized_date']; $getmin = min($new_date,$reply_date,$finalized_date); } return returnTime($getmin); min() is not retrieving the values correctly. I want to retrieve lowest value from columns new_date, reply_date and finalized_date excluding 0. must I use array?
  19. Hello! Does anyone know an effective way to track inactive idlers in daily basis? So that it will count the amount of days no data has been posted to the table. E.g. User posts latest data and inserts timestamp 1282228120 which reads Thursday, August 19th 2010, 14:28:40 (GMT) The days for inactivity should output as 8 days because no data has been posted from 20th August to today - 28th August. Anyway I can achieve this? Any information is appreciated, thanks.
  20. Will this work? new_date is always shown, and reply_date/finalize_date thereafter. $getchallenges = safe_query("SELECT * FROM ".PREFIX."cup_challenges WHERE ladID='$laddID' AND challenger='$teamID' ORDER BY finalized_date DESC, reply_date DESC, new_date DESC");
  21. Hi I can't get the ORDER BY to work correctly: $getchallenges = safe_query("SELECT * FROM ".PREFIX."cup_challenges WHERE ladID='$laddID' AND challenger='$teamID' ORDER BY $order_date DESC"); while($gc=mysql_fetch_array($getchallenges)) { ... if($gc['finalized_date']) $order_date = "finalized_date"; elseif($gc['reply_date']) $order_date = "reply_date"; else $order_date = "new_date"; ... } Is it because of loop? echo "order = $order_date"; output: order = order = order = new_date What I'm trying to achieve is to order by the latest date, but I have 3 date columns: new_date reply_date finalized_date Is it possible to order by multiple columns where largest to smallest?
  22. That depends, (depending on the setting) - user can select from 1 map to 5 or 1 date to 5 (extending to 10 later) The long bit: Maps: if($ds['select_map']==1) { if($_POST['map1']==$_POST['map2'] || $_POST['map1']==$_POST['map3'] || $_POST['map1']==$_POST['map4'] || $_POST['map1']==$_POST['map5']) die('Map option 1 has been selected multiple times!'); $select_map = "map1='".$_POST['map1']."',"; }elseif($ds['select_map']==2) { if($_POST['map1']==$_POST['map2'] || $_POST['map1']==$_POST['map3'] || $_POST['map1']==$_POST['map4'] || $_POST['map1']==$_POST['map5']) die('Map option 1 has been selected multiple times!'); if($_POST['map2']==$_POST['map1'] || $_POST['map2']==$_POST['map3'] || $_POST['map2']==$_POST['map4'] || $_POST['map2']==$_POST['map5']) die('Map option 2 has been selected multiple times!'); $select_map = "map1='".$_POST['map1']."', map2='".$_POST['map2']."',"; }elseif($ds['select_map']==3) { if($_POST['map1']==$_POST['map2'] || $_POST['map1']==$_POST['map3'] || $_POST['map1']==$_POST['map4'] || $_POST['map1']==$_POST['map5']) die('Map option 1 has been selected multiple times!'); if($_POST['map2']==$_POST['map1'] || $_POST['map2']==$_POST['map3'] || $_POST['map2']==$_POST['map4'] || $_POST['map2']==$_POST['map5']) die('Map option 2 has been selected multiple times!'); if($_POST['map3']==$_POST['map2'] || $_POST['map3']==$_POST['map1'] || $_POST['map3']==$_POST['map4'] || $_POST['map3']==$_POST['map5']) die('Map option 3 has been selected multiple times!'); $select_map = "map1='".$_POST['map1']."', map2='".$_POST['map2']."', map3='".$_POST['map3']."',"; }elseif($ds['select_map']==4) { if($_POST['map1']==$_POST['map2'] || $_POST['map1']==$_POST['map3'] || $_POST['map1']==$_POST['map4'] || $_POST['map1']==$_POST['map5']) die('Map option 1 has been selected multiple times!'); if($_POST['map2']==$_POST['map1'] || $_POST['map2']==$_POST['map3'] || $_POST['map2']==$_POST['map4'] || $_POST['map2']==$_POST['map5']) die('Map option 2 has been selected multiple times!'); if($_POST['map3']==$_POST['map2'] || $_POST['map3']==$_POST['map1'] || $_POST['map3']==$_POST['map4'] || $_POST['map3']==$_POST['map5']) die('Map option 3 has been selected multiple times!'); if($_POST['map4']==$_POST['map2'] || $_POST['map4']==$_POST['map3'] || $_POST['map4']==$_POST['map1'] || $_POST['map4']==$_POST['map5']) die('Map option 4 has been selected multiple times!'); $select_map = "map1='".$_POST['map1']."', map2='".$_POST['map2']."', map3='".$_POST['map3']."', map4='".$_POST['map4']."',"; }elseif($ds['select_map']==5) { if($_POST['map1']==$_POST['map2'] || $_POST['map1']==$_POST['map3'] || $_POST['map1']==$_POST['map4'] || $_POST['map1']==$_POST['map5']) die('Map option 1 has been selected multiple times!'); if($_POST['map2']==$_POST['map1'] || $_POST['map2']==$_POST['map3'] || $_POST['map2']==$_POST['map4'] || $_POST['map2']==$_POST['map5']) die('Map option 2 has been selected multiple times!'); if($_POST['map3']==$_POST['map2'] || $_POST['map3']==$_POST['map1'] || $_POST['map3']==$_POST['map4'] || $_POST['map3']==$_POST['map5']) die('Map option 3 has been selected multiple times!'); if($_POST['map4']==$_POST['map2'] || $_POST['map4']==$_POST['map3'] || $_POST['map4']==$_POST['map1'] || $_POST['map4']==$_POST['map5']) die('Map option 4 has been selected multiple times!'); if($_POST['map5']==$_POST['map2'] || $_POST['map5']==$_POST['map3'] || $_POST['map5']==$_POST['map4'] || $_POST['map5']==$_POST['map1']) die('Map option 5 has been selected multiple times!'); $select_map = "map1='".$_POST['map1']."', map2='".$_POST['map2']."', map3='".$_POST['map3']."', map4='".$_POST['map4']."', map5='".$_POST['map5']."',"; }else $select_map = ''; Dates: if($ds['select_date']==1) { if($_POST['date1']==$_POST['date2'] || $_POST['date1']==$_POST['date3'] || $_POST['date1']==$_POST['date4'] || $_POST['date1']==$_POST['date5']) die('Date option 1 has been selected multiple times!'); $select_date = "date1='".$_POST['date1']."',"; }elseif($ds['select_date']==2) { if($_POST['date1']==$_POST['date2'] || $_POST['date1']==$_POST['date3'] || $_POST['date1']==$_POST['date4'] || $_POST['date1']==$_POST['date5']) die('Date option 1 has been selected multiple times!'); if($_POST['date2']==$_POST['date1'] || $_POST['date2']==$_POST['date3'] || $_POST['date2']==$_POST['date4'] || $_POST['date2']==$_POST['date5']) die('Date option 2 has been selected multiple times!'); $select_date = "date1='".$_POST['date1']."', date2='".$_POST['date2']."',"; }elseif($ds['select_date']==3) { if($_POST['date1']==$_POST['date2'] || $_POST['date1']==$_POST['date3'] || $_POST['date1']==$_POST['date4'] || $_POST['date1']==$_POST['date5']) die('Date option 1 has been selected multiple times!'); if($_POST['date2']==$_POST['date1'] || $_POST['date2']==$_POST['date3'] || $_POST['date2']==$_POST['date4'] || $_POST['date2']==$_POST['date5']) die('Date option 2 has been selected multiple times!'); if($_POST['date3']==$_POST['date2'] || $_POST['date3']==$_POST['date1'] || $_POST['date3']==$_POST['date4'] || $_POST['date3']==$_POST['date5']) die('Date option 3 has been selected multiple times!'); $select_date = "date1='".$_POST['date1']."', date2='".$_POST['date2']."', date3='".$_POST['date3']."',"; }elseif($ds['select_date']==4) { if($_POST['date1']==$_POST['date2'] || $_POST['date1']==$_POST['date3'] || $_POST['date1']==$_POST['date4'] || $_POST['date1']==$_POST['date5']) die('Date option 1 has been selected multiple times!'); if($_POST['date2']==$_POST['date1'] || $_POST['date2']==$_POST['date3'] || $_POST['date2']==$_POST['date4'] || $_POST['date2']==$_POST['date5']) die('Date option 2 has been selected multiple times!'); if($_POST['date3']==$_POST['date2'] || $_POST['date3']==$_POST['date1'] || $_POST['date3']==$_POST['date4'] || $_POST['date3']==$_POST['date5']) die('Date option 3 has been selected multiple times!'); if($_POST['date4']==$_POST['date2'] || $_POST['date4']==$_POST['date3'] || $_POST['date4']==$_POST['date1'] || $_POST['date4']==$_POST['date5']) die('Date option 4 has been selected multiple times!'); $select_date = "date1='".$_POST['date1']."', date2='".$_POST['date2']."', date3='".$_POST['date3']."', date4='".$_POST['date4']."',"; }elseif($ds['select_date']==5) { if($_POST['date1']==$_POST['date2'] || $_POST['date1']==$_POST['date3'] || $_POST['date1']==$_POST['date4'] || $_POST['date1']==$_POST['date5']) die('Date option 1 has been selected multiple times!'); if($_POST['date2']==$_POST['date1'] || $_POST['date2']==$_POST['date3'] || $_POST['date2']==$_POST['date4'] || $_POST['date2']==$_POST['date5']) die('Date option 2 has been selected multiple times!'); if($_POST['date3']==$_POST['date2'] || $_POST['date3']==$_POST['date1'] || $_POST['date3']==$_POST['date4'] || $_POST['date3']==$_POST['date5']) die('Date option 3 has been selected multiple times!'); if($_POST['date4']==$_POST['date2'] || $_POST['date4']==$_POST['date3'] || $_POST['date4']==$_POST['date1'] || $_POST['date4']==$_POST['date5']) die('Date option 4 has been selected multiple times!'); if($_POST['date5']==$_POST['date2'] || $_POST['date5']==$_POST['date3'] || $_POST['date5']==$_POST['date4'] || $_POST['date5']==$_POST['date1']) die('Date option 5 has been selected multiple times!'); $select_date = "date1='".$_POST['date1']."', date2='".$_POST['date2']."', date3='".$_POST['date3']."', date4='".$_POST['date4']."', date5='".$_POST['date5']."',"; }else $select_date = ',';
  23. Hey, In my table, I have 773 rows like this: 10800 ... 772 ... 771 ... 770 ... 769 ... etc ... When I insert a new row, it will have an ID of 10801 and not 773. I delete row 10800 and I want to insert a new row that has an ID of 773. Is there a code I can use also so that it creates the IDs in order? 1, 2, 3 etc no missing numbers. Thanks.
×
×
  • 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.