Announcement

Collapse
No announcement yet.

Beginner MySQL Question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Beginner MySQL Question

    I know this is the PHP area, but there is no MySQL specific forum so this seemed like a good place to ask this:

    You know when your script has a database error, like it can't connect for some strange reason or any number of other things, and it says something like "There has been a database error. An email has been sent to the technical contact for this site." - that isn't the exact wording, but it's something like that. Ok, here's my question - where is that email address set up? Is it in the MySQL or PHP config or is it set by the specific script that is running? I am wondering if my error messages are being sent to me and I want to know where I can check to see what email address those error messages would go to. Thanks for answering another newbie question!

  • #2
    I can only guess, but this is not a standard php/MySQL thang

    <assumption>
    Almost certainly your provider has a clever script running that watches for a mysql_error() and then sends an email to the uber techie to figure it out
    </assumption>

    So when does this happen?

    When you run *your* scripts or you've seen it somwhere else?

    regs

    Comment


    • #3
      Error Email

      Hi Bealers - Thanks for the response. I can't figure out which errors cause an email to be sent, but here is one that came to me when I was running one of Ed Sullivan's scripts:

      ---------
      Subject: CPA Site Database error!
      Database error in CPA Site Scripts: Link-ID == false, connect failed
      mysql error:
      mysql error number:
      Date: Monday 26th of June 2000 01:13:49 AM
      Script: /sullivan/get.php?action=getarticle&articleid=43
      Referer: http://mydomainname.com/sullivan/bro...tion&section=3
      ---------

      If I understand what you're saying, then Ed must have wrote this into the code, is that right? Ed is on vacation right now, or I would drop him an note and ask. It's great to get an email when there is an error, because it allows me to keep an eye on any problems that might be developing. So that I'm sure I understand, this is not a fixture of either MySQL or PHP, but something that I would need to add to a script to make it happen?

      Thanks for all of your help!

      Comment


      • #4
        I believe you will find that vbulletin contains this without the cpa article scripts. I also believe you will find that whatever email you specify in the control panel of Vbulletin (the technical email) will receive these errors.
        We're Here Forums!
        [email protected]

        Comment


        • #5
          vBulletin technical contact emails...

          Thanks werehere. I am wondering, though, why I have never got an email from vB, even though I have the email address set up in admin, and I do get emails from Ed's script? Is the implementation in the vB code working? Is there a simple way that you can think of that I could trigger the error (without taking my bb offline) so that I could test it?

          Thanks!

          Comment


          • #6
            To be quite honest I am not sure how to test that, I guess because I have never had a need to try, hmmm...

            I recieve all database errors that are generated from the database, but cannot test a new email with them because I do not recieve them any more (since an upgrade in hardware) and would have to take my BB offline to try as well.

            I hope someone else can come up with a good answer for you, or a way to test them, because I am not aware of any other right off hand.
            We're Here Forums!
            [email protected]

            Comment


            • #7
              I've not installed vBulletin, so I can't comment on how to test the code, but I do know 100% that there is no in-built into either php or mysql function to automgically mail the site owner on a MySQL barf, so there are two options

              1) The code that you are running (I'm assuming that this is vBulletin) has built in functions to look for a MySQL error and mail the email address specified in some settings file somewhere

              2) Less likely, your Hosting Co has some clever shell script that sits around waiting for mysql barfs and mails the account owner
              this is easy to test, create a simple php script a bit like this

              mysql_connect("some","values","of","yours");
              mysql_select_db("a_valid_database");
              mysql_query("INSERT INTO a_table_that_doesnt_exist SET foo='bar'");

              obviously this will barf

              moving on from this, add the lines
              $error = mysql_error();
              if ($error) {
              print "Doh! something ****ed up, it was:<br>" .$error;
              }

              you can see that if the vBulletin dev bods have done soemthing like this, all they've done is email the error to board owner

              hth

              Bealers

              Comment


              • #8
                That part isn't tied into vB. I kinda ripped John's db_mysql file, so I dunno how it works exactly. To change where the email goes to just change the technical email variable in config.php.

                Comment

                widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                Working...
                X