Jump to content

karimali831

Members
  • Posts

    436
  • Joined

  • Last visited

Everything posted by karimali831

  1. Something that did not work for me, not sure why: elseif(($ds['ratio_low'] || $ds['ratio_high']) && clanscoreratio($clanID) < $ds['ratio_low'] || clanscoreratio($clanID) > $ds['ratio_high']) I had to use elseif(($ds['ratio_low'] || $ds['ratio_high']) AND clanscoreratio($clanID) < $ds['ratio_low'] || clanscoreratio($clanID) > $ds['ratio_high']) I thought "AND" and "&&" operate exackly the same? why doesn't "&& clanscoreratio..." work and "AND clanscoreratio.." does work?
  2. Yeah, I changed my post before your reply. -- Thanks.
  3. Ok, so this IF statement if(($ds['ratio_low'] || $ds['ratio_high']) && userscoreratio($userID) >= $ds['ratio_low'] && userscoreratio($userID) <= $ds['ratio_low']) Means if $ds['ratio_low'] or $ds['ratio_high'] is not 0 and userscoreratio (23%) is greater or equal to $ds['ratio_low'] (20%) AND userscoreratio (23%) is equal or lesser than $ds['ratio_high'] (30%) ?? Thanks for help.
  4. This for example: $userscoreratio($userID) = 23% $ds['ratio_low'] = 20% $ds['ratio_high'] = 30% if($userscoreratio($userID) >= $ds['ratio_low'] && =< $ds['ratio_high']) Is this the correct if statement for what I want to achieve?
  5. Hi Ok, so I pick a random value 23 for example and I want this value to be in between two other values. E.g. if 23 is in between 20 and 30, then continue otherwise die. How can I do this?
  6. I had to use php tags to get it working, thank you! <?php $redID = $_GET['cupID']; ?> <body onunload="opener.location=('admincenter.php?site=cups&action=baum&ID=<?php echo $redID; ?>')">
  7. Hi! I can't get a variable to work with this onunload: <body onunload="opener.location=('admincenter.php?site=cups&action=baum&ID='.$_GET['ID'].'')"> It won't load if I use '.$_GET['ID'].' anything else I can do?
  8. Hi, Is this possible to achieve? I want to be able to refresh page when I close a window from a different page. I was thinking Javascript could do this, anyknow know? Take a look at screenshots: Thanks for any help [attachment deleted by admin]
  9. Hi I'm trying to select borderbg, bg1, bg2 in my query WHERE cupID = highest value-1 if that make sense? $style = mysql_query("SELECT borderbg, bg1, bg2 FROM ".PREFIX."cup_baum WHERE cupID=''"); e.g. table: cupID: (auto_increment) 78 77 76 75 ... $style selects borderbg, bg1, bg2 WHERE cupID=77 because it has the highest value-1 in the table. (or second highest) Any help will be great Thanks
  10. Hi, When a user makes a mistake and they go back to the form, all fields are cleared. How can I make it so that when they go back to the form, the data is still inputted? Here is what I got: if($_POST['name']=="") $error_array[] = 'You must enter a title'; if($_POST['info']=="") $error_array[] = 'You must describe the bug'; if($_POST['filename']=="" || $_POST['filename']==".php") $error_array[] = 'You must specify the filename. e.g. cups.php'; if($_POST['errorlocation']=="" || $_POST['errorlocation']=="http://") $error_array[] = 'You must specify the location of this bug, if not, specify your website'; if(count($error_array)) { $error=implode('<br />&#8226; ', $error_array); $showerror = '<div class="errorbox"> <b>Please fix the following error(s):</b><br /><br /> &#8226; '.$error.' </div>'; echo $showerror.'<br /><input type="button" class="button" onClick="javascript:history.back()" value="Go Back">'; }else{ mysql_query() } Any help is appreciated, Thanks!
  11. All I was looking for is if $clanID equals one of the clanID at $dm['clan1'] and it worked perfectly. So like this: $valid = ''.$clanID.'=='.$dm['clan1'].' ||'; if($clanID == 353 || $clanID == 262 || $clanID == 545) and so on...
  12. Managed to do something else with my imagination: $valid = ''.$clanID.'=='.$dm['clan1'].' ||'; if($valid) { } and works
  13. Tried: echo $clans1 = 353, 353, 76, 353, 241, 129, 297, 353, 353, 353, $array1 = array($clan1); $clans1 = implode(", ", $array1); if(353==$clans1) {die('test');} why does not it not die? 353 does equal 353 in array.. ($clans1)
  14. Take a look at the full code: $cupmatches = safe_query("SELECT * FROM ".PREFIX."cup_matches WHERE (clan1='$clanID' || clan2='$clanID') AND (score1 != '0' || score2 != '0') AND (clan1 != '0' AND clan2 != '0') AND (clan1 != '2147483647' AND clan2 != '2147483647')"); while($dm=mysql_fetch_array($cupmatches)) { $clan1 = ''.$dm['clan1'].', '; $clan2 = ''.$dm['clan2'].', '; $array1 = array($clan1); echo implode(", ", $array1); $array2 = array($clan2); echo implode(", ", $array2); if($clanID==$array1) { $cupmatches = safe_query("SELECT SUM(score2) as lostpoints FROM ".PREFIX."cup_matches WHERE clan1='$clanID' AND (clan1 != '0' AND clan2 != '0') AND (clan1 != '2147483647' AND clan2 != '2147483647')"); $ds=mysql_fetch_array($cupmatches); $lostpoints = $ds['lostpoints']; echo "lostpoints = $lostpoints"; }if($clanID==$array2){ $cupmatches2 = safe_query("SELECT SUM(score1) as lostpoints2 FROM ".PREFIX."cup_matches WHERE clan2='$clanID' AND (clan1 != '0' AND clan2 != '0') AND (clan1 != '2147483647' AND clan2 != '2147483647')"); $ds=mysql_fetch_array($cupmatches2); $lostpoints2 = $ds['lostpoints2']; echo "lostpoints2 = $lostpoints2"; } problem now falls under if($clanID==$array1) $clanID is 353 and 353 is in $array1 and it does not echo $lostpoints
  15. Thanks but my only issue is the values that are in the array. For example, $var = ''.$dm['clan1'].', '; $array = array($var); echo implode(", ", $array); If I echo $var, I get : 365, 249, 353, 88, 353, 353, 353, 72, 382, 154, so... $array = array(365, 249, 353, 88, 353, 353, 353, 72, 382, 154, ); question is will $array work even though there is a comma after the last value? if not, what else can I do to use all rows for $dm['clan1'] in the array? Thanks alot for your help
  16. Hi I'm completely new to arrays so wanted to ask if I can use an array like this: while loop { $clan1 = '"'.$dm['clan1'].'", '; echo $clan1; } $clan1 echo = "353", "353", "76", "353", "241", "129", "297", "353", "353", "353", $array = array($clan1); or have I gone across the wrong idea? I want to put all of $dm['clan1'] into array basically.
  17. I'm want to count all values in a column: Is this right?: $points += COUNT($cup['score1']);
  18. Also, I know I missed out AND in query3 but that's not the issue.
  19. Hi, Can someone tell me if query2 will select all rows where ALL cupID has 1 in the 1on1 column at query 1? Secondly, it is not outputting mysql_num_rows correctly from both queries. It does count right however without cupID='".$row['ID']."'. ? $query1 = mysql_query("SELECT ID FROM table1 WHERE 1on1='1'"); while($row=mysql_fetch_array($query1)) { if(this equals that) { $query2 = mysql_query("SELECT * FROM table2 WHERE cupID='".$row['ID']."' AND clan1='$id' AND score1 > score2"); $num = mysql_num_rows($query2); }else $query3 = mysql_query("SELECT * FROM table2 WHERE cupID='".$row['ID']."' AND clan2='$id' score2 > score1"); $num2 = mysql_num_rows($query3); } $total = $num+$num2; } Thanks for help
  20. Hi, I'm looking for a show/hide script for my php page. I tried some but didn't work, this is how I want it: $teamstats.= ' <tr> <td bgcolor="'.$bg1.'" valign="top" rowspan="7">Matches:<br> // TOGGLE - SHOW-HIDE</td> <td align="left" bgcolor="'.$bg1.'"><img src="images/cup/icons/add_result.gif" width="16" height="16" alt="" /> Total Matches: <a href="?site=matches&action=viewmatches&clanID='.$ds['ID'].'">'.$totaltotalusermatches.'</a></td> </tr> //CONTENT TO SHOW/HIDE <tr> <td align="left" bgcolor="'.$bg2.'"><img src="images/cup/icons/add_result.gif" width="16" height="16" alt="" /> Open Matches: <a href="?site=matches&action=viewmatches&clanID='.$ds['ID'].'">'.$openmatches.'</a></td> </tr> <tr> <td align="left" bgcolor="'.$bg1.'"><img src="images/success.png" width="16" height="16" alt="" /> Matches Won: <a href="?site=matches&action=viewmatches&clanID='.$ds['ID'].'">'.$matcheswon.'</a></td> </tr> <tr> <td align="left" bgcolor="'.$bg2.'"><img src="images/error.png" width="16" height="16" alt="" /> Matches Lost: <a href="?site=matches&action=viewmatches&clanID='.$ds['ID'].'">'.$matcheslost.'</a></td> </tr> <tr> <td align="left" bgcolor="'.$bg2.'"><img src="images/icons/online.gif" width="16" height="16" alt="" /> Confirmed Matches: <a href="?site=matches&action=viewmatches&clanID='.$ds['ID'].'">'.$confirmedmatches.'</a></td> </tr> <tr> <td align="left" bgcolor="'.$bg1.'"><img src="images/cup/icons/pending.gif" width="16" height="16" alt="" /> Pending Matches: <a href="?site=matches&action=viewmatches&clanID='.$ds['ID'].'">'.$pendingmatches.'</a></td> </tr> <tr> <td align="left" bgcolor="'.$bg2.'"><img src="images/cup/icons/opened_protest.gif" width="16" height="16" alt="" /> Match Protests: <a href="?site=matches&action=viewmatches&clanID='.$ds['ID'].'">'.$matchprotests.'</a></td> </tr>'; anyone can help please?
  21. Hi, Instead of using the below, how can I generate an array for $row['ID'] and use the array in my query? $query = mysql_query("SELECT ID FROM table WHERE 1on1='1'"); while($row=mysql_fetch_array($query)) { $query2 = mysql_query("SELECT type FROM table2 WHERE ID='".$row['ID']."'"); }
  22. Hi, I want to count how many rows there are two queries, is this possible? e.g. $query1 = mysql_query() $query2 = mysql_query() adding rows in query1 and query2. Thanks for any help.
  23. Hi When I use echo $row['column']; I will get all rows in the column but when I use $variable.=$row['column']; and define $variable on my templates file, I only get one of the rows. I know it is because it is outside the loop but it must be outside so is there another way? 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.