Jump to content

karimali831

Members
  • Posts

    436
  • Joined

  • Last visited

Everything posted by karimali831

  1. Query: }if(isset($_GET['action']) && $_GET['action'] == 'insertlineup') { if(isleader($userID,$_GET['clanID'])){ safe_query("UPDATE ".PREFIX."cup_clan_lineup SET clanID = '".$_GET['clanID']."' && userID = '".$_GET['userID']."' WHERE cupID = '".$_GET['cupID']."'"); redirect('?site=clans&action=mylineup&clanID='.$_GET['clanID']', 'Redirecting...', 2); } Form: $members2=safe_query("SELECT userID FROM ".PREFIX."cup_clan_members WHERE clanID = '$clanID' && function!='Leader'"); while($dr=mysql_fetch_array($members2)) { $member2.='<option value="'.$dr['userID'].'">'.getnickname($dr['userID']).'</option>'; $form = 'Ctrl+Left click to select/deselect <tr bgcolor="'.$bg1.'"> <td align="right" bgcolor="'.$bg1.'">Select Lineup:</td> <td bgcolor="'.$bg2.'"><select name="member" size="5" multiple>'.$member2.'</select> <form action="?site=clans&action=insertlineup&clanID='.$clanID.'&userID='.$dr['userID'].'" method="POST"><input type="submit" value="Enter Selected" /> </form> </td> </tr>'; } echo $form;
  2. Is that better? I now get one userID from the selection.
  3. Sorry, updated my first code you can see now. Thanks
  4. Hi Hoping someone can help me with this. I am trying to insert rows into my table from multiple dropdown selection. Problem is when I submit the form, I don't get userID - &action=insertlineup&clanID=11&cupID=2&userID= clanID will always be one value, but userID can be multiple so not sure how to work round this. userID is from the value of the options. Options - get members: $members2=safe_query("SELECT userID FROM ".PREFIX."cup_clan_members WHERE clanID = '$clanID' && function!='Leader'"); while($dr=mysql_fetch_array($members2)) { $member2.='<option value="'.$dr['userID'].'">'.getnickname($dr['userID']).'</option>'; }; Form: $form = 'Ctrl+Left click to select/deselect <tr bgcolor="'.$bg1.'"> <td align="right" bgcolor="'.$bg1.'">Select Lineup:</td> <td bgcolor="'.$bg2.'"><select name="member" onChange="MM_confirm(\'Are you sure with your selection?\', \'?site=clans&action=insertlineup&clanID='.$clanID.'&userID=\'+this.value)" size="5" multiple>'.$member2.'</select> <form action="?site=clans&action=insertlineup&clanID='.$clanID.'&userID='.$dr['userID'].'" method="POST"><input type="submit" value="Enter Selected" /> </form> </td> </tr>'; } echo $form; Query: }if(isset($_GET['action']) && $_GET['action'] == 'insertlineup') { if(isleader($userID,$_GET['clanID'])){ safe_query("UPDATE ".PREFIX."cup_clan_lineup SET clanID = '".$_GET['clanID']."' && userID = '".$_GET['userID']."' WHERE cupID = '".$_GET['cupID']."'"); redirect('?site=clans&action=mylineup&clanID='.$_GET['clanID']', 'Redirecting...', 2); } Look at attatchment for example: Wraith - value = 6 (userID) -X1-Lite - value = 256 (userID) I want both these userID inserted clanID and cupID don't matter as only one is needed. If this is not possible, any other way to select specific rows from a table and insert into another table? Hope you understand, thanks for any help. [attachment deleted by admin]
  5. I need it for option because the onclick is different for each option you select.
  6. Will you be able to show me how to use the return confirm for onchange or something that says "OK / CANCEL" on a popup when I select an option from the dropdown? e.g. <option value="" onchange="return confirm('');">
  7. Hi, When I use <option value="http://link.com" onclick="return confirm(\'This will take you to this link\');">Link</option> When I select this from the dropdown "Link", it will direct me straight to the link despite the onclick return showing. So I select it from dropdown, shows the onclick but directs me to the page before I have a chance to click on OK or CANCEL?
  8. Hi, When I use the below query: mysql_query("ALTER TABLE `".PREFIX."settings` ADD `col2` INT(11) NOT NULL default '1' AFTER `col1`, ADD `col3` varchar(255) NOT NULL default 'irc.evolu.net' AFTER `col2`;") OR die(PREFIX.'settings failed'); It will die even though I have col2 but not col3 (column) So lets say I have column col2 and not column col3, how can I change the query to that it will add column 3 only? So basically add what I don't have and never mind the columns that are already there. Thanks for help
  9. Hello, With this query, I assume it checks if there are no cup table? if(!mysql_num_rows(mysql_query("SHOW TABLES LIKE '".PREFIX."cups'"))) How can I check if a column existings within a table? So lets say I altered a table and added column "name" and I use a query to check if this column exists? Is there a query I can use for this? Thanks for help.
  10. Sorry don't totally understand, I'm PHP beginner
  11. Hi, Got a prob. $getteams=safe_query("SELECT clanID, userID FROM ".PREFIX."cup_clan_members WHERE userID='$userID'"); while($te=mysql_fetch_array($getteams)) { I echo clanID in $getteams query above: echo '<br>clanID = '.$te['clanID'].''; Output: clanID = 11 clanID = 35 clanID = 37 = is correct. Now I want to use $te['clanID'] in $registered query below: $registered=safe_query("SELECT * FROM ".PREFIX."cup_clans WHERE clanID='".$te['clanID']."' && 1on1='0' && cupID='$cupID'"); if(!mysql_num_rows($registered)) { echo 'no rows'; }else{ echo 'is rows'; } Output: clanID = 11no rows clanID = 35is rows clanID = 37no rows == is correct Problem: If I used if(!mysql_num_rows($registered)) { die('die'); } it will die but there is rows for clanID 35? (above) Don't know much about how loops work but if I changed the query from clanID='".$te['clanID']."' to clanID='35' it'll work fine. So I don't want it to die if there is rows for any clanID in the loop if that makes sense? From the looks of it, it will die if a single clanID has no rows. Hope you understand and thanks for help.
  12. When I use if($num == 0) die(); above fetch it dies but below fetch it doesn't. So this doesn't work?
  13. Thanks, that's just what I needed.
  14. There maybe rows and there maybe no rows, rows is checked when the user is logged in. $registered=safe_query("SELECT * FROM ".PREFIX."cup_clans WHERE clanID='".$te['clanID']."' && 1on1='0' && cupID='$cupID'"); But as you say loop won't run if these is no rows then I can't use mysql_num_rows under it?
  15. Hi, Got a problem. For the first one, it will die if no rows. $registered=safe_query("'"); if(!mysql_num_rows($registered)) die(); while($dd=mysql_fetch_array($registered)) { ... } For this one, it does not die if there is no rows and I'm not sure why? When it is under fetch it does not understand or something? $registered=safe_query("'"); while($dd=mysql_fetch_array($registered)) { if(!mysql_num_rows($registered)) die(); ... } I need it under for reasons. what can I do or is there something else I can use so that it will work in the loop? Thank you for help.
  16. Perfect, that worked. Thanks very much
  17. Hi, I have a problem with this query: $gameacc = safe_query("SELECT gameaccID FROM ".PREFIX."cups WHERE ID = '$cupID'"); $ds=mysql_fetch_array($gameacc); $mem = safe_query("SELECT userID FROM ".PREFIX."cup_clan_members WHERE clanID = '$clanID'"); while($db = mysql_fetch_array($mem)) { $result = safe_query("SELECT value FROM ".PREFIX."user_gameacc WHERE userID = '".$db['userID']."' && type = '".$ds['gameaccID']."'"); $anz_mem = mysql_num_rows($result); echo '<br>ent = '.$anz_mem.''; The result of $anz_mem is like this: ent = 1 ent = 2 ent = 3 so this means 1/2/3 rows in the loop? I would like this all added together, 1/2/3 = 6 so $anz_mem = 6 and not ent = 1 ent = 2 ent = 3 anyone understand? Hope so Thanks for help
  18. Not really, besides it needs to start with if(preg_match(... Never used this before so I don't know what the delimiters are.
  19. I'm trying to understand it but I just don't get it. can't someone change the ereg to preg_match please? if (ereg('[^A-Za-z0-9]', $name) to if (preg_match(w/e goes here.)
  20. I'm not familiar with.. perhaps you could help me out?
  21. Ok I use preg_match but it doesn't convert. $name = $ds['nickname']; if (preg_match('[^A-Za-z0-9]', $name)) { $func = preg_replace ( '/[^A-Za-z0-9]/', '', $name); $name = $func; return $name; }else{ return $ds['nickname']; }
  22. I've been advised not to use ereg as it may not work sometimes but don't know anything else I can use for the below code: $name = $ds['nickname']; if (ereg('[^A-Za-z0-9]', $name)) { $func = preg_replace ( '/[^A-Za-z0-9]/', '', $name); $name = $func; return $name; }else return $ds['nickname']; so the above ereg changes $name to alphanumeric. anything else I can use instead of ereg?
×
×
  • 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.