Jump to content

karimali831

Members
  • Posts

    436
  • Joined

  • Last visited

Everything posted by karimali831

  1. Hi all, I have mistakenly inserted duplicated rows and will take forever removing them manually so hoping someone can help me with the SQL to remove duplicated results. You can see the image where the duplicated row begins and so on. The rows userID, clanID and cupID shouldn't have a duplicate. I have fixed this in my script just need to get rid of the duplicates and obviously only having 1 one of the rows. Thanks to anyone
  2. It would be too much bother if I did not use timestamp as the code is now adapted to fetch timestamps from database and can use date() to get the correct date format which works fine.
  3. I changed data type to int(15) and it now stores timestamp but now need to change the WHERE clause to reflect to timestamp?
  4. Hey, I need help with date, I have stored dates in my table in this format: i.e. 22.10.2011 but now use timestamp to store dates. Problem is with this query the WHERE clause will find dates in the old format and I want to change that to the new format. for($i = $count; $i > 0; $i--) { $day = date("d.m.Y", mktime(0, 0, 0, date("m"), date("d") - $i, date("Y"))); $tmp = mysql_fetch_array(safe_query("SELECT count FROM ".PREFIX."counter_stats WHERE dates LIKE '%".$day."'")); $array[] = $tmp['count'] ? $tmp['count'] : 0; } Am I making sense ?
  5. Hey.. hoping someone can help me on a this issue I have been having for 4 days now. My host has tried to figure out what is causing it and has told me they are finding it very strange, everytime my website is up on their server it will take 600%-800% CPU so they must take it down for fair usage on other customers of course. They said they can easily track and trace websites that are overloading the resources but mine seems too complicated to understand as it is having legitmate traffic (on average 30 users online and 300 visits daily) which would never be the cause of CPU spikes to 600%-800%. They either believe it is a "clever attack" or some PHP script perhaps looping like mad. Anyone help me and my host figure out the problem as we obviously both don't like the website to continue to be offline. The website has very standard content CMS running and clean database it makes no sense to the both of us. Like to mention the last activity I had done on the website was when I tried to insert into database:- Query failed: errorno=126 error=Incorrect key file for table './teamxcom_webspell/ws_bi2_cup_matches.MYI'; try to repair it query=DELETE FROM ws_bi2_cup_matches WHERE matchno='5' && type='gs' && ladID='0' && 1on1='1' Then after I tried to perform query from database: Error SQL query: SELECT * FROM `ws_bi2_cup_matches` ORDER BY `ws_bi2_cup_matches`.`matchID` DESC LIMIT 0 , 30 MySQL said: #1030 - Got error 134 from storage engine Then found out the table on phpmyadmin had wrong page numbers in sequence:- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 379, 746, 1113, --, --, --7349 After I contacted web host they mentioned it is causinga massive problem and took it down after that. Anyone can shed some light on this please? Sorry if it is posted in wrong section! Thanks very much
  6. Hey, This will be too difficult for me to do or even searching up how to get this done, take a look at this pic: http://team-x1.co.uk/design/header.jpg Where it says "OUR GAMES" I want this to be rotating around every 5 seconds or so. As a complete newbie on this can someone put me in the right direction please? I hope so Thank you..
  7. This is an example hard-coded bracket, it is just repetition. Looking to get this created with PHP. I have ideas but not sure how to get it started, I know loops must be used.. if someone has an example or if someone can start me off here I'd appreciate it very much! <div id="turnierbaum_div"> <table align="center" cellpadding="$cellpadding" cellspacing="0" width="100%"> <tr valign="center"> <td width="100" class="title" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap"> $round1</td> <td width="100" class="title" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap"> $round2</td> <td width="100" class="title" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap"> $round_sf_ub</td> <td width="100" class="title" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap"> $round_gf_ub </td> <td width="100" class="title" align="center" style="font-weight: bold" nowrap="nowrap"> $winner</td> </tr> <tr valign="top"> <td bgcolor="$c_bg1" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap">Map: $dd[map1]</td> <td bgcolor="$c_bg1" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap">Map: $dd[map2]</td> <td bgcolor="$c_bg1" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap">Map: $dd[map3]</td> <td bgcolor="$c_bg1" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap">Map: $dd[map4]</td> <td bgcolor="$c_bg1" style="border-bottom:1px solid $dd[borderbg]; border-right:1px solid $dd[borderbg];"> </td> </tr> <tr> <td colspan="9"></td> </tr> <tr> <td bgcolor="$c_bg1" align="center">$clan[1]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[1]</td> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"></td> <td></td> </tr> <tr> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[1]</td> <td bgcolor="$c_bg1" align="center">$clan[9]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[5]</td> <td colspan="2"></td> <td colspan="2"></td> <td></td> </tr> <tr> <td bgcolor="$c_bg1" align="center">$clan[2]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[1]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td colspan="2"></td> <td colspan="2"></td> <td></td> </tr> <tr> <td colspan="2"></td> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[5]</td> <td bgcolor="$c_bg1" align="center">$clan[13]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[7]</td> <td colspan="2"></td> <td></td> </tr> <tr> <td bgcolor="$c_bg1" align="center">$clan[3]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[2]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td colspan="2"></td> <td></td> </tr> <tr> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[2]</td> <td bgcolor="$c_bg1" align="center">$clan[10]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[5]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td colspan="2"></td> <td></td> </tr> <tr> <td bgcolor="$c_bg1" align="center">$clan[4]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[2]</td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td colspan="2"></td> <td></td> </tr> <tr> <td colspan="2"></td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[7]</td> <td bgcolor="$c_bg1" align="center">$clan[15]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[8]</td> <td></td> </tr> <tr> <td bgcolor="$c_bg1" align="center">$clan[5]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[3]</td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> </tr> <tr> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[3]</td> <td bgcolor="$c_bg1" align="center">$clan[11]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[6]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> </tr> <tr> <td bgcolor="$c_bg1" align="center">$clan[6]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[3]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td align="center" style="border-right:2px solid #333333;" colspan="2">$detail[8]</td> <td bgcolor="$c_bg1" align="center">$clan[wb_winner]</td> </tr> <tr> <td colspan="2"></td> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[6]</td> <td bgcolor="$c_bg1" align="center">$clan[14] </td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center">$score2[7]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> </tr> <tr> <td bgcolor="$c_bg1" align="center">$clan[7]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[4]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> </tr> <tr> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[4]</td> <td bgcolor="$c_bg1" align="center">$clan[12]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[6]</td> <td colspan="2"></td> <td bgcolor="$c_bg1" align="center">$clan[16]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center">$score2[8]</td> <td></td> </tr> <tr> <td bgcolor="$c_bg1" align="center">$clan[8]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[4]</td> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"></td> <td></td> </tr> <tr> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"> </td> <td></td> </tr> <tr> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"></td> <td></td> </tr> <tr valign="center"> <td width="100" class="title" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap"> $round1_lb </td> <td width="100" class="title" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap"> $round2_lb</td> <td width="100" class="title" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap"> $round_sf_lb</td> <td width="110" class="title" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap"> $round_gf_lb</td> <td width="100" class="title" align="center" style="font-weight: bold" nowrap="nowrap" nowrap="nowrap"> $lower_winner</td> </tr> <tr valign="top"> <td bgcolor="$c_bg1" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap">Map: $dd[map5]</td> <td bgcolor="$c_bg1" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap">Map: $dd[map6]</td> <td bgcolor="$c_bg1" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap">Map: $dd[map7]</td> <td bgcolor="$c_bg1" align="center" colspan="2" style="font-weight: bold" nowrap="nowrap">Map: $dd[map8]</td> <td bgcolor="$c_bg1" style="border-bottom:1px solid $dd[borderbg]; border-right:1px solid $dd[borderbg];"> </td> </tr> <tr> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"></td> <td></td> </tr> <tr> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"></td> <td bgcolor="$c_bg1" align="center">$clan[27]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center">$score1[14]</td> <td></td> <tr> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> <tr> <td colspan="2"></td> <td bgcolor="$c_bg1" align="center">$clan[21]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[11]</td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> <tr> <td colspan="2"></td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> <tr> <td colspan="2"></td> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[11]</td> <td bgcolor="$c_bg1" align="center">$clan[25]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center">$score1[13]</td> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[14]</td> <td bgcolor="$c_bg1" align="center">$clan[lb_winner]</td> <tr> <td bgcolor="$c_bg1" align="center">$clan[17]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[9]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> <tr> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[9]</td> <td bgcolor="$c_bg1" align="center">$clan[22]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[11]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> <tr> <td bgcolor="$c_bg1" align="center">$clan[18]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[9]</td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td></td> <tr> <td colspan="2"></td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[13]</td> <td bgcolor="$c_bg1" align="center">$clan[28]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center">$score2[14]</td> <td></td> <tr> <td bgcolor="$c_bg1" align="center">$clan[19]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[10]</td> <td colspan="2"></td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td colspan="2"></td> <td></td> <tr> <td style="border-right:2px solid #333333;" align="center" colspan="2">$detail[10]</td> <td bgcolor="$c_bg1" align="center">$clan[23]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score1[12]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td colspan="2"></td> <td></td> <tr> <td bgcolor="$c_bg1" align="center">$clan[20]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[10]</td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td style="border-right:2px solid #333333;" colspan="2"> </td> <td colspan="2"></td> <td></td> <tr> <td colspan="2"></td> <td align="center" style="border-right:2px solid #333333;" colspan="2">$detail[12]</td> <td bgcolor="$c_bg1" align="center">$clan[26]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[13]</td> <td colspan="2"></td> <td></td> <tr> <td colspan="2"></td> <td style="border-right:2px solid #000000;" colspan="2"> </td> <td colspan="2"></td> <td colspan="2"></td> <td></td> <tr> <td colspan="2"></td> <td bgcolor="$c_bg1" align="center">$clan[24]</td> <td bgcolor="$c_bg2" style="border-right:2px solid #333333;" align="center" width="4%">$score2[12]</td> <td colspan="2"></td> <td colspan="2"></td> <td></td> </tr> </table> </div>
  8. Hi! I want to be able to create a dynamic tournament bracket but not sure where to get started, right now all the template brackets have been hardcoded, i.e. http://teamx1.com/templates/64.html Can you someone put me in the right direction by using PHP to create and write this file? I want to be able to create 64 + brackets but hardcoding is a huge headache and mistakes easily done. Thanks all.
  9. I have other question, want to do something simular - WHERE first letter is non-alphabet? So it can be anything such as WHERE = |?><!£$%^& etc
  10. Thanks very much!! Brilliantly simple
  11. Hi, I am using while loop to fetch rows of users and want to add an A - Z search, if the user clicks "S" for example it should return all results where the first letter of string (whether upper case or not) is equal to "S" or "s". Can I do this with WHERE clause? Thanks anyone.
  12. I tried td.title { border-spacing:0px 0px; } but it is showing as 1px and 1px in previous code. thanks for help.
  13. Am I able to exclude a class? I want the below style for tr, td and table but excluding: td class="title" I tried some research and found: table:not(.title) but this does not work <style> tr, td, table { padding:4px; border-collapse:separate; border-spacing:1px 1px; border-color:#000000; } fieldset, legend { margin:4px; padding:4px; } </style> Any help please?
  14. Hello, When I post content to database and query from database \r\n\ is suppose to be new line indent so if I posted this: test test hello I will get: test\r\ntest\r\n\r\nhello\r\nhello How to fix this? Thanks for any help.
  15. Brilliant thanks very much! I thought it didn't work because $points = 0; wasn't declared above loop, and was getting all crazy values. why must this be done?
  16. When you add all the values it will be 41 so I just want the output to be 41 so it is like: while() { $row['col1']; -- sum up all values in $row['col1'] }
  17. Hey, Can someone please fix my code below? I simply want to add all values for $row[score1] in first if statement and add all values for $row[score2] in second if statement and then add them together to return final value . while( $row = mysql_fetch_assoc($query)) { if($clanID==$row[clan1] && $row[score1] > $row[score2]) { $points[] = $row[score1]; } if($clanID==$row[clan2] && $row[score1] < $row[score2]) { $points[] = $row[score2]; } } return $points; . So lets say I echo the variables that I want added... if($clanID==$row[clan1] && $row[score1] > $row[score2]) { $points[] = $row[score1]; echo $row['score1']."<br>"; } if($clanID==$row[clan2] && $row[score1] < $row[score2]) { $points[] = $row[score2]; echo $row['score2']."<br>"; } On page it returns as: 11 16 14 Add it together is 41 and this is what I want the output to be. Hope you understand I appreciate any help! P.S. I must be able to return final value OUTSIDE loop. Thanks.
  18. What is wrong with me.. no idea why I didn't think of this thanks a lot!
  19. Hi! For all my queries I use safe_query() and this function returns mysql_query() Now I want to count how many queries is being returned in this function... can someone modify the code and assign a variable to return max returns please? I would be grateful, thanks! // -- MYSQL QUERY FUNCTION -- // $_mysql_querys = array(); function safe_query($query="") { global $_mysql_querys; if(stristr(str_replace(' ', '', $query), "unionselect")===FALSE AND stristr(str_replace(' ', '', $query), "union(select")===FALSE){ $_mysql_querys[] = $query; if(empty($query)) return false; if(DEBUG == "OFF") $result = mysql_query($query) or die('Query failed!'); else { $result = mysql_query($query) or die('Query failed: ' .'<li>errorno='.mysql_errno() .'<li>error='.mysql_error() .'<li>query='.$query); } return $result; } else die(); }
  20. I have tried this but the style affects index.php still <?php $listOfPages = array("news","articles"); if(in_array($_GET['site'],$listOfPages)){ ?> <style> tr, td, table { padding:4px; border-collapse:separate; border-spacing:1px 1px; border-color:#000000; } </style> <?php } ?> index.php?site=articles
  21. Hello Sorry if I can't explain this properly, I'll give it a try.. I add some style in index.php: <style> .... </style> I use links such as: index.php?page=news index.php?page=articles etc. Now I only want to use the style in news, articles but not index.php itself if that makes sense? I can add the style in news, articles files itself but the style will be affected in index.php which I don't want.
  22. Hey! I am sure there is a way round this... I am using one column to store both IP and port e.g. 123.45.67.89:1234 I want to fetch only the IP, so I want to the output before the double dot. Can someone show me how I can do this please? Many 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.