Jump to content

Destramic

Members
  • Posts

    969
  • Joined

  • Last visited

Everything posted by Destramic

  1. Personally make the colours more natural...it seems too vibrant...and with your content and side menu on the right if your able to put them in a clear section so the site content has a divide? Obviously it's all up to you but if I can give you a idea that you like then winner winner Good luck
  2. Hey guys I've been reading the manual for zend framework 2...I under stand the layout helper...but a bit confused on where and when you would use the view to render and set variables? Would it be when you've disabled the layout helper and not wanting to include header, footer, side menus etc? Hope my question is clear and someone can explain when you would use the view instead of the layout helper
  3. Looking at the manual and as you say using Utc_timezone() to store the date does seem a easier way to do things...how would I select the timestamp then and convert it to another timezone on select?...thanks for your help guys
  4. brilliant article...definitely gonna have a update timestamp ...thank you well I was thinking of using <?php define('TIMEZONE', 'Europe/London'); date_default_timezone_set(TIMEZONE); ?> to set the default timezone so when I used now() in my queries it'll be saved as gmt? and yes like you said I have a column for the user to select his/her timezone but how do I change a timestamp to another timezone? thanks
  5. hey guys I wanting some information on the best way to store a timestamp and how I would convert that timestamp to another timezone please? im guessing I would firstly store all timestamps to the database in GMT OR BST then convert after according to users timezone preference? Is there a good website for this please on how this is possible...thank you
  6. Hey guys im having 2 minor problems with my script if someone can give me some advise please? (all 2 problems are commented on the script itself) 1. highlighting string characters when typed. 2. also im trying to add "Hide Suggestions" at the bottom of my menu so people can turn on/off autocomplete $(document).ready(function() { function search_autocomplete(selector, tags, default_value) { $('#' + selector).focus(function() { if($('#' + selector).val() == default_value) { $('#' + selector).val(''); } }); $('#' + selector).blur(function() { if($('#' + selector).val() == '') { $('#' + selector).val(default_value); } }); $('#' + selector).autocomplete( { source: tags, timeout: 0, select: function (a, b) { $(this).val(b.item.value); //submit }, create: function () { $(this).data('ui-autocomplete')._renderItem = function (ul, item) { // not highlighting when string characters match var re = new RegExp('^' + this.term); var t = item.label.replace(re, "<span id='dropdown-item-highlight'>" + "$&" + "</span>"); return $('<li></li>') .append('<a>' + t + ' in ' + item.type + '</a>') .addClass( 'dropdown-item' ) .appendTo(ul); }; } }); $(this).data('ui-autocomplete')._renderMenu = function (ul, item) { // unable to show "Hide Suggestions at the bottom of the autocomplete menu return $('<ul></ul>') .append('<a>Hide Suggestions</a>') .addClass( 'dropdown-menu' ); }; } var availableTags = [{"label" : "XBOX 360", "type":"Electronics"}, {"label":"XBOX One", "type":"Electronics"}, {"label":"Nike", "type":"Clothing & Footwear"}]; search_autocomplete('query', availableTags, 'Search...'); }); thanks
  7. helpers are able to be turned off buy using this style .ui-helper-hidden-accessible { display: none } although after solving that one problem I have come across another...my unable to view my source, which might have something to do with the way I have my array? $(document).ready(function() { function search_autocomplete(selector, tags, default_value) { $('#' + selector).focus(function() { if($('#' + selector).val() == default_value) { $('#' + selector).val(''); } }); $('#' + selector).blur(function() { if($('#' + selector).val() == '') { $('#' + selector).val(default_value); } }); $('#' + selector).autocomplete( { source: tags, timeout: 0, create: function () { $(this).data('ui-autocomplete')._renderItem = function (ul, item) { return $('<li>') .append('<a>'<br>' + item.product + ' /a>') .appendTo(ul); }; } }); } var availableTags = [{"product":"XBOX 360", "Type":"Electrics"}, {"product":"XBOX One", "Type":"Electrics"}, {"product":"Nike", "Type":"Clothing & Footwear"}] search_autocomplete('query', availableTags, 'Search...'); }); what im wanting is to have the products in my array to be the source...thank you
  8. yeah well maybe it would be better to use paypal or something to do the transactions...thank you
  9. yeah that is just what I need some styling..but like I said when the results drop down box appears with suggestions, for some reason further down the page it says how many results available and what result picked?
  10. thank you that works great...now when the list comes down from the input box how would I get to the options to change the format of the list please? also it generates this at the bottom of my page "3 results are available..." which I also would like to get rid of please
  11. thank you...eeek spelling mistake...ok well I've change all that but it's still not functioning $(document).ready(function() { function search_autocomplete(selector, tags) { $( '#' . + selector).autocomplete( { source: tags }); } var availableTags = [ "ActionScript", "AppleScript", "Asp"]; search_autocomplete('query', availableTags); });
  12. hey guys im trying to get an autocomplete script working at the moment...although im pretty new to jquery...ive added jquery.js and jquery-ui.js (I think I need both?) here is my code if anyone can give me some pointers please...thank you <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <script type="text/javascript" src="media/scripts/library/jquery.js"></script> <script src="media/scripts/library/jquery-ui.js"></script> <script> $(document).ready(function() { function autocomplete(selecor, tags) { $( '#' . + selector).autocomplete( { source: tags }); } var availableTags = [ "ActionScript", "AppleScript", "Asp"]; autocomplete('query', availableTags); }); </script> <title></title> </head> <body> Search: <input type="text" name="q" id="query" /> </body> </html>
  13. I'm not sure if im explaining myself very well here but basically user 1 and user 2 will have bank details saved to a secure database. what I want to do is transfer a amount of money from one user to another users bank account (HSBC, Halifax etc...) is there a good tutorial on how I could do this?
  14. thank you...basically I want to transfer money just between one user and another and that's it...obviously I'd have to get a banking licence for that country eg. user 1 transfers £20.00 to user 2
  15. hey guys im really just after a bit of help/information on 2 things (hope its in the right forum). 1. basically I'm wanting to make payments from one account to another online...like paypal does...im wondering what I would need to do to be able to do this if anyone can shine some light please? 2.as seen on google you type in a query in the search bar and it generates sentences/keywords from a database example: so if product "chair" was in the database whilst typing "ch" it would show "chair" for a possible match I know it would in tale sql & json but im after a good tutorial/script of some sort. if anyone can help with some information/sites it would be much appreciated. Thank you
  16. basically every table is joined in that query although I did change a few things about like you said (which I should of done before because it makes perfect sense)...now this query is returning everything I need without a sub query like the previous versions of this query...thank you once again for your help again SET @rank := 0; SET @points := 0; SET @tie := 0; SET @win_streak := 0; SET @loss_streak := 0; SET @draw_streak := 0; SELECT *, @rank := IF(@points = points, IF(@points = '0', @rank = '0', @rank), @rank + 1), @points := points, IF(@points = points, IF(@points = '0', @tie = '0', @tie = '1'), @tie = '0'), IF(@tie = '1', @rank + 1, @rank) as rank, @tie := '0' FROM (SELECT l.league_id, t.team_id, t.team_name, plm.previous_rank, plm.rank_movement, plm.status, COUNT(fr.fixture_result_id) AS 'matches_played', SUM(IF(fr.result='Win', 1, 0)) AS `wins`, SUM(IF(fr.result='Loss', 1, 0)) AS `losses`, SUM(IF(fr.result='Draw', 1, 0)) AS `draws`, SUM(IF(fr.result='Win', l.win_points, IF(fr.result='Draw', l.draw_points, IF(fr.result='Loss', l.loss_points, 0)))) AS `points`, FORMAT(IFNULL(SUM(IF(fr.result='Win', 1, 0)) / COUNT(fr.fixture_result_id), 0), 2) AS `win_ratio`, FORMAT(IFNULL(SUM(IF(fr.result='Win', 1, 0)) / COUNT(fr.fixture_result_id) * 100, 0), 2) AS `win_percentage`, @win_streak := IF(fr.result='Win', @win_streak +1, @win_streak = 0) AS `win_streak`, @Loss_streak := IF(fr.result='Loss', @win_streak +1, @win_streak = 0) AS `loss_streak`, @Draw_streak := IF(fr.result='Draw', @win_streak +1, @win_streak = 0) AS `draw_streak` FROM Leagues l LEFT JOIN player_league_mappings plm ON plm.league_id = l.league_id INNER JOIN fixtures f ON f.challenger_player_id = plm.player_id OR f.opponent_player_id = plm.player_id AND f.type = 'League' INNER JOIN fixture_results fr ON fr.player_id = plm.player_id INNER JOIN player_team_mappings ptm ON ptm.player_id = plm.player_id INNER JOIN teams t ON t.team_id = ptm.team_id INNER JOIN team_game_mappings tgm ON tgm.team_id = t.team_id INNER JOIN game_game_platform_mappings ggpm ON ggpm.game_game_platform_mapping_id = tgm.game_game_platform_mapping_id INNER JOIN game_platforms gp ON gp.game_platform_id = ggpm.game_platform_id AND gp.game_platform_name = 'xbox 360' INNER JOIN games g ON g.game_id = ggpm.game_iD AND g.game_abbreviation = 'CS:S' WHERE l.league_name = 'Counter-Strike Team Death Match' GROUP BY t.team_id ORDER BY points DESC, t.team_name) AS x
  17. wow now that is a good method of showing a streak...impressive...maybe something i'll do when im able to get the data I want from database being a rookie at MySQL I had a good read about gathering more than one column from a sub query thanks to your help...although I have stumbled across one more while altering my query basically im unable to get a result other than 0 when trying to get a win_percentage and win_ratio...any thoughts?...thank you again SELECT *, @rank := IF(@points = points, IF(@points = '0', @rank = '0', @rank), @rank + 1), @points := points, IF(@points = points, IF(@points = '0', @tie = '0', @tie = '1'), @tie = '0'), IF(@tie = '1', @rank + 1, @rank) as rank, @tie := '0' FROM (SELECT l.league_id, t.team_id, t.team_name, plm.previous_rank, plm.rank_movement, plm.status, COUNT(fr.fixture_result_id) AS `matches_played`, SUM(IF(fr.result='Win', 1, 0)) AS `wins`, SUM(IF(fr.result='Loss', 1, 0)) AS `losses`, SUM(IF(fr.result='Draw', 1, 0)) AS `draws`, SUM(IF(fr.result='Win', l.win_points, IF(fr.result='Draw', l.draw_points, IF(fr.result='Loss', l.loss_points, 0)))) AS `points`, FORMAT(IFNULL(SUM(IF(fr.result='Win', 1, 0)) / COUNT(fr.fixture_result_id), 0), 2) AS `win_ratio`, FORMAT(IFNULL(SUM(IF(fr.result='Win', 1, 0)) / COUNT(fr.fixture_result_id) * 100, 0), 2) AS `win_percentage` FROM Leagues l LEFT JOIN player_league_mappings plm ON plm.league_id = l.league_id LEFT JOIN fixtures f ON f.challenger_player_id = plm.player_id OR f.opponent_player_id = plm.player_id LEFT JOIN fixture_results fr ON fr.player_id = plm.player_id LEFT JOIN player_team_mappings ptm ON ptm.player_id = plm.player_id LEFT JOIN teams t ON t.team_id = ptm.team_id LEFT JOIN team_game_mappings tgm ON tgm.team_id = t.team_id LEFT JOIN game_game_platform_mappings ggpm ON ggpm.game_game_platform_mapping_id = tgm.game_game_platform_mapping_id LEFT JOIN game_platforms gp ON gp.game_platform_id = ggpm.game_platform_id LEFT JOIN games g ON g.game_id = ggpm.game_id WHERE gp.game_platform_name = 'xbox 360' AND g.game_abbreviation = 'CS:S' AND l.league_name = 'Counter-Strike Team Death Match' AND f.type = 'League' GROUP BY t.team_id ORDER BY points DESC, t.team_name) AS x
  18. thank you...what would be the best way to get the streak results im after please?
  19. Hey guys im trying to get a win/loss and draw streak using the code I've written down below (@win_streak := IF(lfr1.result='Win', @win_streak +1, @win_streak = 0)), (@loss_streak := IF(lfr1.result='Loss', @loss_streak +1, @loss_streak = 0)), (@draw_streak := IF(lfr1.result='Draw', @draw_streak +1, @draw_streak = 0)) The problem is when I add the @loss_streak and @draw_streak lines to the query it then brings up this error any help would be grateful thank you Here is the full SQL SELECT *, @rank := IF(@points = points, IF(@points = 0, @rank = 0, @rank), @rank +1), @points = points, IF(@points = points, IF(@points = 0, @tie = 0, @tie = 1), @tie = 0), IF(@tie = 1, @rank +1, @rank) AS `rank`, @tie = 0 FROM( SELECT l.league_id, t.team_id, t.team_name, tlm.previous_rank, tlm.rank_movement, tlm.status, (SELECT (@win_streak := IF(lfr1.result='Win', @win_streak +1, @win_streak = 0)), (@loss_streak := IF(lfr1.result='Loss', @loss_streak +1, @loss_streak = 0)), (@draw_streak := IF(lfr1.result='Draw', @draw_streak +1, @draw_streak = 0)) FROM league_fixture_results lfr1 LEFT JOIN league_fixtures lf ON lf.league_fixture_id = lfr1.league_fixture_id WHERE lfr1.team_id = t.team_id AND lf.league_id = l.league_id ORDER BY lfr1.created DESC), @win_streak AS `win_streak`, @loss_streak AS `loss_streak`, @draw_streak AS `draw_streak`, @win_streak := 0, @loss_streak := 0, @draw_streak := 0, COUNT(lfr2.league_fixture_result_id) AS 'matches_played', SUM(IF(lfr2.result='Win', 1, 0)) AS `wins`, SUM(IF(lfr2.result='Loss', 1, 0)) AS `losses`, SUM(IF(lfr2.result='Draw', 1, 0)) AS `draws`, SUM(IF(lfr2.result='Win', l.win_points, IF(lfr2.result='Draw', l.draw_points, IF(lfr2.result='Loss', l.loss_points, 0)))) AS `points`, FORMAT(IFNULL(SUM(IF(lfr2.result='Win', 1, 0)) / COUNT(lfr2.league_fixture_result_id), 0), 2) AS `win_ratio`, FORMAT(IFNULL(SUM(IF(lfr2.result='Win', 1, 0)) / COUNT(lfr2.league_fixture_result_id) * 100, 0), 2) AS `win_percentage` FROM teams t LEFT JOIN league_fixture_results lfr2 ON lfr2.team_id = t.team_id LEFT JOIN team_league_mappings tlm ON tlm.team_id = t.team_id JOIN leagues l JOIN games g WHERE g.game_abbreviation = 'CS' AND l.league_name = 'CS' GROUP BY t.team_id ORDER BY points DESC, t.team_name) AS x
  20. hey guys im having a problem with the ajax sctipt...basically when i used selects an option in the game_platforms i want the ajax to then work when the json is encoded....help please...i dont know why it aint running the code is below...thank you guys php getting the array if (!empty($_POST['game_platform'])) { $game_platform_value = $_POST['game_platform']; $platform_games_rows = $game_platform->select_platform_games($game_platform_value); json_encode($platform_games_rows); } ajax....not working $(document).ready(function() var post_string = 'game_platform=' + $(this).val(); $.ajax ({type: 'POST', data: post_string, cache: false, dataType: 'json', url: 'add_league.html', timeout: '2000', error: function(data) { console.log(data); }, success: function(data) { alert('yes'); } }); }); the html form <form method="post"> <input type="hidden" name="game_add" value="0" /> <label for="league_name">League Name:</label> <input type="input" name="league_name" id="league_name" /> <br /> <label for="league_size">League Size:</label> <input type="input" name="league_size" id="league_size" /> <br /> <label for="league_status">League Status:</label> <select id="league_status"> <option>Active</option> <option>Inactive</option> </select> <label for="game_platform">Game Platform:</label> <select name="game_platform" id="game_platform"> <option value=""></option> <option value="<br /> <b>Notice</b>: Undefined index: platform_abbreviated in <b>C:\www\private\application\views\leagues\add_league.html</b> on line <b>108</b><br /> ">Play Station 2</option> </select> <br /> <div id="create_game_expanded"> <div id="create_game_collapse">Select existing game</div> <br /> <label for="game_name">Game Name:</label> <input type="input" name="game_name" id="game_name" /> <br /> <label for="game_name_abbreviated">Game Name Abbreviated:</label> <input type="input" name="game_name_abbreviated" id="game_name_abbreviated" /> <br /> <label for="game_icon">Game Icon:</label> <input type="file" name="game_icon" id="game_icon" /> <br /> <label for="game_type">Game Type:</label> <input type="input" name="game_type" id="game_type" /> <br /> <label for="game_type_abbreviated">Game Type Abbreviated:</label> <input type="input" name="game_type_abbreviated" id="game_type_abbreviated" /> <br /> </div> <div id="create_game_collapsed"> <div id="create_game_expand">Create game</div> <br /> </div> </form>
  21. hey guys im trying to get this query working but im getting an error if anyone could tell me whats going wrong please....thank you SELECT CONCAT("[", GROUP_CONCAT( CONCAT("{platform_abbreviation:'", gp.platform_abbreviation,"'"), CONCAT(",game_name:'", g.game_name), CONCAT(",game_abbreviation:'", g.game_abbreviation),"'}") ) ,"]") AS json FROM game_platform_mappings gpm LEFT JOIN game_platforms gp ON gp.game_platform_id = gpm.game_platform_id LEFT JOIN games g ON g.game_id = gpm.game_id error im getting
  22. t dont the way i wanted to do it but i decided to generate the table inside the javascript loop <!DOCTYPE html> <html> <head> <script src="media/scripts/library/jquery.js" type="text/javascript"></script> <script> $(document).ready(function() { var search_value; var column_headings = ["Username", "E-mail Address"]; var rows = [{"username":"destramic", "email":"destramic@hotmail.com"}, {"username":"process", "email":"process@hotmail.co.uk"}]; $('#search_query').keyup(function () { var search_value = $('#search_query').val(); var found_entries = new Array(); $.each(rows, function(index, row) { $.each(row, function(column, column_value) { if (column_value.indexOf(search_value) !== -1) { if ($.inArray(row, found_entries) == -1) { found_entries.push(row); } } }); }); if (found_entries.length > 0) { var content; content += "<tr>"; $.each(column_headings, function(index, heading) { content += "<th>" + heading + "</th>"; }); content += "</tr>"; $.each(found_entries, function(index) { content += "<tr>"; content += "<td>" + found_entries[index]['username'] + "</td>"; content += "<td>" + found_entries[index]['email'] + "</td>"; content += "</tr>"; }); content += "</table>"; $('div#user_rows').html(content); found_entries.length = 0; } else { $('div#user_rows').html("No results found for: " + search_value); } }); $('#search_query').focusout(function () { search_value = $('#search_query').val(); if (search_value == "") { $('#search_query').val("Search..."); } }); $('#search_query').click(function () { search_value = $('#search_query').val(); if (search_value == "Search...") { $('#search_query').val(""); } }); }); </script> </head> <body> <input type="text" name="search_query" id="search_query" value="Search..." /> <div id="user_rows"></div> </html>
  23. ive tried that and it did work...the probelm is with the div inbetween the table tags...dunno why...cause if the div is moved out then it works
×
×
  • 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.