karimali831
Members-
Posts
436 -
Joined
-
Last visited
Everything posted by karimali831
-
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;
-
Is that better? I now get one userID from the selection.
-
Sorry, updated my first code you can see now. Thanks
-
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]
-
I need it for option because the onclick is different for each option you select.
-
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('');">
-
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?
-
no? you can not do this?
-
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
-
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.
-
Sorry don't totally understand, I'm PHP beginner
-
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.
-
When I use if($num == 0) die(); above fetch it dies but below fetch it doesn't. So this doesn't work?
-
Thanks, that's just what I needed.
-
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?
-
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.
-
Perfect, that worked. Thanks very much
-
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
-
Not really, besides it needs to start with if(preg_match(... Never used this before so I don't know what the delimiters are.
-
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.)
-
I'm not familiar with.. perhaps you could help me out?
-
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']; }
-
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?