Jump to content

Shadowing

Members
  • Posts

    722
  • Joined

  • Last visited

Everything posted by Shadowing

  1. Thanks for the reply. Lol my tablet auto filled that word lol. I need to return the position the player is in rank
  2. Having a issue on figuring how to do this. I have a table with a unique I'd with a int column for a rank system. I need to figure out what rank a player is. Right now I'm selecting the players rank and then doing a count all rows where rank is >= $players_rank I'm using pigmentation links so I'm trying to figure out what page the user would be on. The problem is in a rare situation where more then one player has the same amount of rank and the rank is split up over two pages. Hope I explained this good enough. Its a pickle of a problem
  3. Alright I solved my problem using IFNULL GROUP_CONCAT(NULLIF(bombers,'') separator '-') AS bombers Thanks for the amazing help you provided Barand you are a true saint to this forum of phpfreaks.com
  4. I figured out its cause of my null values on some rows. Not sure how to get around that so it ignores null rows
  5. my return looks like this now 50000---50000-50000-50000-50000-- my columns do look exactly like this '50-6-7-8-3-4-5' not sure where these extra - are coming from
  6. I figured out my issue almost. apparently i have to set a Alias to grab from it so GROUP_CONCAT(bombers separator '-') as bombers
  7. I'm unsure where your confusion lies Barand I need mysql to return in the same pattern when all bombers rows are being added together so bombers row1 looks like '50-6-7-8-3-4-5' bombers row2 looks like '50-6-7-8-3-4-5' bombers row3 looks like '50-6-7-8-3-4-5' i need the return to be '50-6-7-8-3-4-5-50-6-7-8-3-4-5-50-6-7-8-3-4-5'
  8. Thanks for teh reply Barand bombers look like 50000-5000-45600-54369 I need the return to end up in the same pattern when adding all the bombers columsn up where id equals user_id
  9. Hey guys having issues trying to get group_concat to work. If its even what im looking for All these columns are INT accept bombers which is a string What I want to do is also add each bombers columns with a - seperator "SELECT SUM(naqahdah) , COUNT(*) , SUM(slaves) , SUM(jaffa) , SUM(unas) , SUM(resources) , SUM(death_gliders), SUM(threaders) , GROUP_CONCAT(bombers separator '-') , SUM(staff_cannons) , SUM(naqahdah_mines) FROM planets WHERE id= $user_id GROUP BY id"; If anyone could kindly help
  10. One thing though make sure you escape WHERE nick='".mysql_real_escape_string($q)."'");
  11. Yah the information will be gone because the information was never on that page for starters. when you use ajax it opens up its own instance of li.php so having another li.php open isnt the same page. Did you really use developer tools to see ted frog? if so then it really did send that information to that page and you can use it in your query for your data base.
  12. what we are trying to do is send data from your java script page to the li.php page so simply going to chat/li.php in your browser you are not sending any data from the java script page. You are simply just opening up li.php page. Thats why you have to use developer tool to see what gets echoed on the li.php page When you load the page with your java script on it. it sends that ajax call which opens up the li.php page for you but also sends your data to that page via POST. Developer tools lets you read whats on that page when it opens. so if you use the code i just had you test and you just simply open chat/li.php it wouldnt echo anything. Infact you would get a warning saying variables doesnt exist.
  13. That means its working. so we need to figure out whats differant on your other pages thats not making it work are you calling your javascript with on document load wraping your java script with $(function(){ });
  14. I decided to take some time out and test your code out works fine for me in IE9, Firefox and chrome so lets start from basics save your javascript and php page somewhere now on the orginal two pages get rid of everything accept this on your javascript page <script> $(function(){ var user_name= 'ted'; var password= 'frog'; xmlhttp2=new XMLHttpRequest(); xmlhttp2.open("POST","li.php",true); xmlhttp2.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xmlhttp2.send("q="+user_name+"&r="+password); }); </script> and this on your php page echo $_POST['r']." and ".$_POST['q']; now open up chrome developer tools by clicking options at the very top right of your browser go down and click on tools and then developer tools now refresh the page click on network tab in the developer tools and click on li.php on the list on the left should display frog and ted
  15. echo this on the php file echo ('path to file li.php is '.__FILE__); tell me what you get is chrome the only browser you have tried?
  16. uhh thats wierd Is that with the jquery code? cause that error is telling you that your php file isnt in your chat folder Is all your folder names and file names in lowercase letters cause its probably case sensitive
  17. I always take ajax links from the document root so in your case chat/li.php
  18. Is li.php is in your chat folder? or is it in your htdocs folder?
  19. If you can't figure chrome developer tools out can try this with jquery. "Even though you really need to use developer tools :p" $.ajax({ url: "li.php", type: 'POST', dataType: 'json', data: { q: userName, r: password }, error: function(){ console.log("Oops... seems to be a problem retrieving data") }, success: function(response) { var r = response.r; var q = response.q; alert("r is "+r+" and q is "+q); } }); Then on your php page get rid of all echo's and insert at the very bottom of all your code echo json_encode(array("r" => $_POST['r'], "q" => $_POST['q'])); This will return the Post back to your Dom
  20. lets make a few changes place this at the top of your page ini_set("display_errors", "1");error_reporting(-1); change your data base interaction from $result=mysql_query("SELECT pass FROM chat WHERE nick='$q'"); $row=mysql_fetch_array($result); to $query = "SELECT pass FROM chat WHERE nick='$q'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); echo "query string is $query <br />"; echo "db return is ".$row['pass']." <br />"; paste what you echo from that
  21. Oh well I guess i decided to push jquery on him even harder? Its possible he ignored it cause he didnt want to look up how to use jquery. So i brought it back up in the conversation with exactly what he needs incase he decided to use it.
  22. I would just use jquery include this link in the <head></head> of your page. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script> Then use jquery ajax frame work below. I filled you information in for ya. Also a tip when creating varaibles i would really use all lowercase letters instead of doing userName. Be better to do user_name $.ajax({ url: "li.php", type: 'POST', dataType: 'json', data: { q: userName, r: password }, error: function(){ console.log("Oops... seems to be a problem retrieving data") }, success: function(response) { // anything you want return from php page } });
  23. You want to use cookies for this unless they are logged in use a database
×
×
  • 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.