Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. Can you cut out unrelated code and post a simple example demonstrating the problem? Or you can post the whole thing if it's not too big.
  2. If a query returns no data, mysql_fetch_array() will not return an array, causing the extract() to fail with that message. So you should check if $row_a and $row_d are arrays first. Bruce Almighty looks like it might be the problem, as the lead actor and director do not exist.
  3. This line: $player_attack_value=$hp_computer="2"; is equivalent to $hp_computer = "2"; $player_attack_value = $hp_computer; Is that what you intended?
  4. I think you need to make requests in parallel to speed things up. For example, you could have 3 copies of your script. Script 1: Processes urls 0, 3, 6, 9, ... Script 2: Processes urls 1, 4, 7, 10, ... Script 3: Processes urls 2, 5, 8, 11, ... Then you'll get things done in 1/3 the time, as you have 3 requests active at any one time. There may be an interface in php to do this within one script, but I have never used such a thing.
  5. How about this: if ($gridy<20 && $gridx < 20) { echo "<div><td $background width='50' height='50'>$imgsrc</div></td>"; } else { echo "<div><td $background2 width='50' height='50'>$imgsrc</div></td>"; }
  6. MasonPrice, we need to see the actual generated query, as well as the error. For example: echo "About to run $query<br>"; $result = mysql_query($query) or die(mysql_error()); Otherwise it's like working in the dark. I suspect the issue is that user_info is running into WHERE, forming one token.
  7. topflight, I suggest you put some time into learning about sessions. They are ideal for your situation. A single session will by default be shared among all pages on the server (considering virtual servers as different servers), allowing you to tell all pages that the user is logged in. For example, if you store data in a session in login.php, that data will be available in index.php, submit.php, and every other php script that calls session_start().
  8. Aha. Try using single quotes (') instead of double quotes (") in php. That should pass the \n through unaltered, where javascript can change it into a newline. return str_replace("\r\n", '\n', $this->options['ImportantEventInformation']); The reason being that "\n" in php is translated into an actual newline characters. But '\n' is not processed at all by php.
  9. I'm not clear on what your problem is. What is the exact output you want? And how does the javascript display the string?
  10. For debugging, add this code just after session_Start() on each page. You can remove it when you've fixed the problem: print "<pre>"; var_dump($_SESSION); print "</pre>"; That will tell you the contents of $_SESSION. If it's empty, then your problem is getting sessions working. If it's not empty, then your problem is that your script is not using the session data.
  11. What kind of attack are you trying to prevent?
  12. I'm guessing that he's suggesting you fetch the page using php and parse it with php. There's a few ways to fetch the page, depending on how much control you need. If it's just a simple request, you can use file_get_contents("http://www.blah.com/blah.html?arg=foo"); If it's a post, you probably need to use curl (you can google that). As for the parsing, that depends on what the javascript looks like.
  13. This should fix it: <?php session_start(); ?><html> <body> <?php include ('login.php'); ?> <p /><p /> <a href="register.php">Register if you are not a member</a> </body> </html> Even that html tag at the start is enough to interfere with sessions, so you need to start them first.
  14. What are you trying to do when you get the error? Register? Login? To debug the problem, try printing out each mysql query before executing it. It's likely you'll be able to see the problem.
  15. It's /home/qwo/bon-temps/index.php:3 that we need to see. If index.php is producing output, then you must put session_start() before that output. It's a good idea to put session_start() at the very top of your script.
  16. Putting the password in a cookie is not a great idea. But the simplest way to fix all of this is to use sessions. A session contains trusted data (in the sense that only data you put there will be there), meaning you can simply store username and a flag saying the user has logged in, and that's enough.
  17. The first step should be to ask your hosting company about it. Assuming that doesn't help (and it probably won't), you can try these: PEAR::Mail PEAR::Net_SMTP (more low level, try PEAR::Mail first)
  18. I see code like this: PG(http_globals)[TRACK_VARS_GET] It appears to be a zval *. That might be the one you're looking for.
  19. You can have acceptfriend() take an argument. The argument could be an identifier for the current friend, or it could be a the object itself that you want to manipulate. BTW, "id" is supposed to be unique within a page. You could use id='insert_response1', id='insert_response2', etc etc. Then you could pass that unique identifier into acceptfriend(), which could use it to find the appropriate element.
  20. if (!empty($var['aa']['xx'])) will tell you if $var['aa']['xx'] is not empty(). Would that be enough?
  21. In the second one, avg(Sum(sal) - max(sal)) looks suspicious. sum() and max() are already aggregates that will give a single result, and you cannot take the average of a single result. Instead you should either use a where clause to exclude the highest salary and then use avg(), or do the average calculation explicitly using sum() and max() and count().
  22. Hmm.. if you are doing a lot of updates to those user tables, then it might help to split the tables actually. I usually use postgres which acts differently in these situations. I'm going to suggest this thread be moved to the mysql forum, where there's some mysql experts lurking If you do need multiple tables and you also need to find which table a user is in, then you probably need some kind of global index. This could be a mysql table as well, or it could be stored externally. It's difficult to make a suggestion without knowing the access patterns though. Eg, if 99% of your queries look up a user by user_id, then you can speed up 99% of queries by having another table that tells you which user table holds which user_id. You'll need to be careful that that global table doesn't have the same scaling problems as the original user tables though. Which depends on why the original table wasn't scaling. If you tend to get repeated requests for the same user_ids, then you should see a large benefit by using a caching layer like memcache. Eg if you look up a user on every hit, a memcache can satisfy all those requests except the first. If the user's data is updated, then you trigger an update of the memcache entry so everything is consistent.
  23. Try removing the extra spaces in here: echo " < div id = 'field' > <label for = '$field'> $value </label> <input id = '$field'name = '$field'type = '$type'value = '".@$$field."'size = '40'maxlength = '65' / > < div > \n"; So there is no space between the "<" and the "div", for example.
  24. Does that code work? If not, what does it do?
×
×
  • 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.