Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. Try fsockopen('http://www.domain.com'). The problem is most likely that the Host: header, which tells a webserver which site to server, is invalid.  The server then falls back to serving the default site.  If none of this works, try using the CURL functions. http://sg.php.net/manual/en/ref.curl.php
  2. Can you post exact code that reproduces the behaviour?  A copy of the php.ini on both servers would help too.  There's been no "auto-copy-by-reference" change in 5.2, so the source of the unexpected behaviour is somewhere else. Edit: It may well be this: [quote]If register_globals  is enabled, then each global variable can be registered as session variable. Upon a restart of a session, these variables will be restored to corresponding global variables. Since PHP must know which global variables are registered as session variables, users need to register variables with session_register() function. You can avoid this by simply setting entries in $_SESSION. If register_globals  is enabled, then the global variables and the $_SESSION entries will automatically reference the same values which were registered in the prior session instance. However, if the variable is registered by $_SESSION  then the global variable is available since the next request.[/quote]
  3. Is there any half-reasonable way to simulate a different collation order for an order by in postgres?
  4. Is http://sg.php.net/manual/en/function.session-name.php what you are looking for? I don't fully understand what you are trying to do, but that will let you set the session name.
  5. Given your situation, I might even do it in php, unless efficiency is a problem. There's pretty much two options - Do the calculation in PHP and do invididual updates, or do the calculation in SQL and do a single update.  One way requires individual updates, the other does a single update. You can try each and see how it performs.  Good luck :)
  6. The parse error you're getting is because you are using " inside your query, but " also starts and ends your query.  Unfortunately I don't know mysql syntax all that well, so I can't tell you how to fix it.
  7. Host is probably 127.0.0.1, and port you should leave blank if possible.  3306 is the default. For database, that will be whatever name you used when you created your database.  If you haven't created your database yet, go back into mysql and do it :)  A single copy of mysql can have several "databases" running inside it, each with different names.
  8. btherl

    Using LIKE

    Can you give more detail?  LIKE will only match a row once, even if the searched for phrase appears multiple times.
  9. Try this: [code=php:0]SELECT name, adate = '' AS pending FROM users JOIN entries ON (account) WHERE manage = '{$r_u['account']}'[/code] Your results will be 2 columns, name and pending.  Pending will be true if adate = '' for that user.  The join on account just means "Match up rows where account is matching".
  10. Just use this: [code=php:0]UPDATE table SET field = field + 8[/code]
  11. How are you accessing mysql?  Using phpmyadmin?
  12. [code=php:0]select * from table where column1 IN ($value1, $value2) and column2 IN ($value3, $value4) limit 1[/code] That'll work if you want all combinations of all values.  If you want only matching combinations, then I think you will need to do it the hard way: [code=php:0]select * from table where (column1 = $value1 and column2 = $value2) or ($column1 = $value3 and column2 = $value4) or ...[/code]
  13. You can create a hidden div containing the "Page is loading" message.. then when someone clicks a link, use javascript to unhide the div.  You can also hide a div containing your page's normal contents at the same time.  That's a simple solution. More complex is if you want to avoid browser timeouts by repeatedly refreshing the page.
  14. Are you sure your entire script isn't being run twice?  Are you able to check your request logs to see if it's happening?
  15. btherl

    replace into

    The documentation is here: http://dev.mysql.com/doc/refman/5.1/en/replace.html From that page [quote] MySQL uses the following algorithm for REPLACE (and LOAD DATA ... REPLACE):   1.Try to insert the new row into the table   2.While the insertion fails because a duplicate-key error occurs for a primary key or unique index:         1.Delete from the table the conflicting row that has the duplicate key value         2.Try again to insert the new row into the table[/quote] That would indicate that a unique index on the values you want to be unique will have the effect you want, ie it will force replacement rather than creating a new row.
  16. See http://dev.mysql.com/doc/refman/5.1/en/example-auto-increment.html [quote] To start with an AUTO_INCREMENT value other than 1, you can set that value with CREATE TABLE or ALTER TABLE, like this: mysql> ALTER TABLE tbl AUTO_INCREMENT = 100;[/quote]
  17. You can list each of your columns seperately, and limit the column you want to limit [code=php:0]SELECT s_id, s_name, SUBSTRING(s_notes FROM 0 FOR 250) AS s_notes FROM strains WHERE s_breeder='$id'[/code]
  18. Try adding ua.approved into the select list (ie, the results of the query) and see what you end up with.
  19. There are plenty of other ways, such as regular expressions.  Why don't you want to use like?
  20. Enclose each of your variables like this: [code=php:0]echo "<tr><td colspan=2>{$ani[$newnum][desc]}</td></tr>";[/code] '{' at the start, and '}' at the end.
  21. What about this? [code=php:0]UPDATE users SET progress = progress + rate FROM jobposition WHERE jobposition.jpid = users.jpid[/code] I'm not 100% sure it will work, but it's worth a try :)
  22. You're missing [code=php:0]))[/code] after the "if" condition.
  23. Just use two queries :)  If the count is too slow, maybe you can fix it with an index on the expression you're matching on.
  24. To avoid this problem, only use nl2br() when you are displaying the data.  Keep another copy of the data before nl2br(), and put that copy into the database. You may have to have 2 form variables, one displayed and one hidden.
  25. You can store the number of times clicked in mysql, or in a text file.  How to do either of those is best answered by a tutorial.
×
×
  • 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.