Jump to content


Staff Alumni
  • Posts

  • Joined

  • Last visited

Everything posted by btherl

  1. I've seen screen.width, screen.height and screen.colorDepth used in javascript to find screen size and color depth. You would need to then send that information to PHP.
  2. Specifically, $_GET['doc_refer'] should have the value you're looking for.
  3. The count(*) is based on the group by. So if you group by r.refREFER, count(*) will be the number of result for each r.refREFER. If the question is "How results are there for each X", then the solution is "SELECT X, count(*) FROM table GROUP BY X" If the question is "What is the total of Y for each X", then the solution is "SELECT X, sum(Y) FROM table GROUP BY X"
  4. The count will be named "count" by default, and can be accessed as $r2['count']. But you can also rename it, eg: $q2=mysql_query("SELECT u.userid, u.username, r.refREFERIP, r.refREFER, COUNT(*) AS referred_count ... <td>{$r2['referred_count']}</td> There's no need to use php's count() as MySQL has already counted the rows for you.
  5. Did you add the 5th team to Pandemikk's code? He included only 4, not 5. Also I would add these debugging statements at each step to check that the values are correct: <?php $teams = array( 0 => 1, 1 => 2, 2 => 3, 3 => 4 ); // preserve team_ids $teamids = array_values($teams); print "<pre>";var_dump($teamids);print "</pre>"; // randomize shuffle($teams); print "<pre>";var_dump($teams);print "</pre>"; // old team_ids are the keys and randomized team_ids are the values $teams = array_combine($teamids, $teams); print "<pre>";var_dump($teams);print "</pre>"; foreach ($teams AS $key => $val) { $db->query("UPDATE ancl_teammeta SET team_id = $val WHERE tmeta_id = $key"); } ?>
  6. Do all the entires with the same IP have matching records for both refREFER and refREFED in the users table? By default, a join will ignore anything which doesn't match in all tables. If that is the case, use a LEFT JOIN for both joins with the users table. You won't get a username though because there isn't one, you'll just get a user id.
  7. diablo3, I just noticed your "for" loop starts at 1 - your arrays are indexed from 0 so it should start at 0, like this: for($i = 0; $i < count($nonrandom_teamno); $i++) Pandemikk's advice is good too - it's more elegant to use a foreach loop here. And his solution leaves less room for logic errors.
  8. Can you do this please and post the output: for($i = 1; $i < (count($nonrandom_teamno)+1); $i++) { $query = "UPDATE ancl_teammeta SET team_id ='$random_teamno[$i]' WHERE tmeta_id='$nonrandom_teamno[$i]'"; print "Going to do: $query<br>"; $db->query($query); }
  9. If you are using my query, replace $r['username'] with $r['u2username'] in both places it appears. That's because I used "AS u2username" to name the column fetched from joining with the users table the second time to get the refREFED username.
  10. Instead of preg_match() try this: if (strpos($line_of_text, $aryItem) !== false) preg_match() needs a delimited string as input, eg "|6274|", where "|" is the delimiter. preg_match() is much more powerful and flexible than strpos(), but from what I understand you don't need it here.
  11. The "or die(mysql_error())" should go after mysql_query(), not after mysql_fetch_array(). What happened when you tried the queries?
  12. system() returns only the last line of output, but shell_exec() returns the entire output. And system() can optionally give you the return code of the command. Based on my reading of the manual, those are the only differences. I don't know about your second question. Can you verify that the connection is being made (for example using a network sniffer or the server logs) and that output is being sent? In theory, socat doesn't know it's being run under php so its behaviour shouldn't change. But it MAY know that it's not connected to a terminal, and many programs change behaviour based on that.
  13. What's happening there is you are setting a local $test to 10, then it gets overwritten when you do "global $test;". Declaring a variable global will actually overwrite any local copy you had in that function. If you set the value after declaring it global then it'll work as you expect.
  14. Is the issue that you want to look up 2 usernames with the one query? You can join the users table twice like this: SELECT u.userid, u.username, u.laston, u2.userid AS u2userid, u2.username AS u2username, u2.laston AS u2laston, r.* FROM referals r JOIN users u ON u.userid = r.refREFER JOIN users u2 ON u2.userid = r.refREFED WHERE r.refREFERIP=r.refREFEDIP ORDER BY u.userid ASC I've made it a JOIN because I don't understand why you used a LEFT JOIN there. If you do have a good reason for doing so then you can add it back in.
  15. What if you change the order of those two replacements? As long as you order it so the inside replacements take place after the outside ones you should be ok.
  16. You could abstract out the updates into a function, so your main code would have 3 calls to that function instead of 3 queries followed by 3 query executions. That's a small gain in readability. Also I don't see where $register_query is used. And you shouldn't need to mysql_select_db() a second time.
  17. tec-4, Is that $property->$zipcode or $property->zipcode?
  18. An array can't be passed directly like that, but you can serialize it: <?php $stud_serialized = serialize($stud); echo "<input type='hidden' name='ar_std' id='ar_std' value='$stud_serialized' /> </table>" ; // And in your receiving script $ar_stud = unserialize($_POST["ar_std"]); ?> But you are probably better off storing it in $_SESSION
  19. Try this: <?php // /home/person-mike.txt // /home/person-sarah.txt // /home/person-paul.txt $sendrequest = array(); while ($row = sqlite_fetch_array($result)) { $name = $row['name']; $filename = "/home/person-$name.txt"; $handle = fopen($filename, "r"); $sendrequest[$name] = fread($handle, filesize($filename)); fclose($handle); } ?> <?php if ( $client == "sarah" ) { echo "$sendrequest[sarah]"; } // Or to simplify that last "if" condition: echo $sendrequest[$client]; ?>
  20. Have you tried changing the encoding in your browser to see if any other encoding displays it correctly?
  21. Well you have set $offset in the first line there, but where is $offset used? If you want to use $offset in the query you need to add it to $query before calling mysql_query(). I'm not sure of the exact syntax as I'm a Postgres user.
  22. What if you use the code which produces your last result there, then remove the extra c2 and c3 tags in another step?
  23. You might want to try preg_replace_callback() instead.
  24. You can either use the value $offset and $rowsperpage in the mysql query itself, or you can use them in the loop over $i which displays each row. Right now those values are defined but then not used.
  25. If you can increase memory then I would try it. That last message you posted shows the 64M limit again, so the change may not have taken effect. Googling for "wordpress memory issues" shows several discussions that might have some good ideas. The reason I'm not recommending trying to diagnose the problem is because you're using a third party package (wordpress), and it's generally easier to increase memory than to try to analyze such a large system, as long as you have enough memory available.
  • 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.