Search results

  1. M

    PHP magic methods

    @Alex: it looks like a bug report (and patch) for this was filed awhile ago (2 years, at this point), but has yet to be included into the codebase. @Submariner: since standard PHP doesn't support concurrency within the language, simultaneous access of PHP variables shouldn't be a problem...
  2. M

    MySQL Unknown Database 'Database Name' Error

    What makes you sure? The OP stated the script is a part of a tutorial. Moreover, if you head over to tizag and look at their mysql connect tutorial, you see a script remarkably similar to what the OP posted (the lack of a call to mysql_connect in the posted script likely being a mistake on the...
  3. M

    MySQL Unknown Database 'Database Name' Error

    Ignore that tutorial as far as bridging PHP and MySQL is concerned, as the mysql drive is outdated and has been supplanted twice over. Switch to using PDO. Try "Writing MySQL Scripts with PHP and PDO" for a tutorial.
  4. M

    Critical: E-mail script not mailing (i think)

    Finally, the registration script: <?php # THIS IS A TEST SCRIPT AND NEEDS TO BE TESTED AND DEBUGGED BEFORE A USER GETS IT include_once('dbg.php'); include_once('LocalDB.php'); include_once('normal_quotes.php'); include_once('FormData.php'); //$dbgLvl = 1; # uncomment to debug...
  5. M

    Critical: E-mail script not mailing (i think)

    No sir, I don't like it. See "Re: Display all that would be secret while Mysql is broken" for an implementation of LocalDB used in the following. LocalDB is used to isolate DB user credentials, reducing typo and security problems. Here's a rewrite of bdistler's latest script, with various...
  6. M

    PHP magic methods

    Not at the language level. As the docs say, The solutions are to use a function you explicitly call (as you're doing now) or to extend PHP to add support __getStatic and __setStatic magic methods and submit a patch.
  7. M

    javascipt target blank

    Why are you using JS with a non-anchor rather than the semantically correct anchor (<a>) elements? HTML should define the document structure. This is very important because computers, having no intelligence, need cues in order to deal with data. Elements are cues as to the meaning of the data...
  8. M

    javascipt target blank

    Using an onclick doesn't open a URL, so the concept of "target" doesn't really apply. What are you doing? Please post a minimal test case.
  9. M

    mysql_connect error

    rajat44, some warnings, should you be tempted to incorporate bdistler's script into your site (rather than using it as a one-off to test connecting to MySQL): you shouldn't use die when outputting HTML. You should also handle errors at the appropriate point, which isn't often when the error is...
  10. M

    sql error

    As the error says, "`databaseName` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" isn't a valid SQL statement. To set the default character set for a database, use the ALTER DATABASE statement. Basically, prefix the problematic statement with ALTER DATABASE and it should fix the syntax...
  11. M

    DOM Efficiency

    document.getElementById('announcements').getElementsByTagName('*'); should get all descendent elements, though this will only work for your purposes if the last child of #announcements doesn't have any element children of its own. It will also be less efficient than scanning through the child...
  12. M

    Drop down menus top of forum page not working

    The cause is the following rule from additional.css: .navtabs ul{ ... top:39px; ... } Adding the following in the appropriate place will fix the menu offset problem, though it may cause others. .navtabs .popupbody { top: 27px; }
  13. M

    run javascript in ajax response

    What, exactly, do you expect the code to do? What does it do instead (including any errors)? The "Form" and "AJAX" labels aren't particularly helpful. Instead, state what files (e.g. "ajax_amo.php") the code fragments from, and include the functions they are a part of within the code itself...
  14. M

    Server Error in '/' Application

    As mentioned in a couple different threads, Mono (the Apache module that provides ASP.Net) isn't working right now, and will probably be dropped.
  15. M

    mysql_connect error

    MySQL usernames should be your cpanel username, followed by an underscore, followed by the name you created in cPanel. The above username ("urworld") thus looks incorrect. The "Access denied for user" error has been covered in many threads. Search the forums to look for solutions to your...
  16. M

    Accessing database within class

    A variable isn't global until declared so; you need to declare global variables before setting them. Try: function foo() { $a = "locally scoped in " . __FUNCTION__; echo __FUNCTION__, " local \$a: $a\n"; global $a; echo __FUNCTION__, " global \$a: $a\n"; } foo()...
  17. M

    Accessing database within class

    As the error message says, $discountdomain isn't a valid MySQL link. (You can always dump a variable if it's not what you expect, or (better yet) use an interactive debugger.) The first time the method is invoked, "discountdomains.php" is executed in the scope of the method, so any global...
  18. M

    Problem inserting serialized array

    Use a PDO prepared query. Since values are sent out-of-band, metacharacters are a non-issue.
  19. M

    suggestion Java IDE (Linux)

    VI, while a powerful editor, is not an IDE, and doesn't offer everything an IDE offers. If an IDE is truly what you desire, don't settle for an editor (not that there's anything wrong with developing with an editor). I mostly use Eclipse but wouldn't recommend it; no-one would describe it as...
  20. M

    Javascript on change event

    Firstly, a checkbox (<input type="check" .../>) is more natural than a select when the options are yes/no. Second, if you're asking how to show or hide an element, you can set the element's display to 'none' or (better yet) create a class that has a display of "none". To hide an element, give it...
Top