Jump to content

thegraingers

Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Posts posted by thegraingers

  1. my question, which appears to have been lost is

     

    Is it better on a web page to open a mysql connection at the start of the page, do a number of queries and then close the database connection

     

    OR

     

    if it is possible to split the queries up would it be better to do a number of open, query, close operations.

     

     

    a typical page might look like this

    query for advert selection

    query to log advert shown

     

    query for another advert

    query to log advert

     

    query to populate part of a side menu

    query for a poll in side menu

     

    query for page content

     

    query for another advert

    query to log advert

     

    etc

  2. [!--quoteo(post=332047:date=Jan 1 2006, 10:16 AM:name=tjhilder)--][div class=\'quotetop\']QUOTE(tjhilder @ Jan 1 2006, 10:16 AM) 332047[/snapback][/div][div class=\'quotemain\'][!--quotec--]

    Sorry I wasn't with it the other day lol

     

    in the form now is:

    <input type="hidden" name="email_id[]" />

     

    and in the PHP/MySQL part is:

            if (isset ($_POST['submit']))  // Handle the form.
                    {
                foreach ($_POST['email_id'] as $email)
                {
                    // Define the query.
                    $send_all = "SELECT username, email FROM members";
    
                        if ($result = mysql_query ($send_all)) { // Run the query.
    
                            $row = mysql_fetch_array ($result); // Retrieve the information.
                                        // Send the email.
                            $body = "\n\nThe following message has been sent by ".$_POST['sentby']." at www.tjhilder.co.uk/index.php\n\n----------------------------------------------\n\n";
                            $body .= stripslashes($_POST['message']);
                            $body .= "\n\n----------------------------------------------\n\nIf you believe you got this e-mail by mistake, please ignore this message.\n\nPlease DO NOT reply to this message.\n";
                            mail($row['email'], $_POST['title'], $body, 'From: tjhilder.co.uk <admin@tjhilder.co.uk>');
    
                             $information = "<br /><br /><span style=\"color : green; font-weight : bold;\">Your E-mail has been Sent!</span>";
                        } else { // Query didn't run.
                            $information = "<br /><br />Could not send E-mail because: <b>" . mysql_error() . "</b>. The query was $send_all.";
                        } // End of query IF.
                    }
                }
            }
    

     

    think it looks alright, just wanted to be 100% sure before I test it,.. if it goes wrong I may end up annoying alot of people at once :P

     

     

    If your worried about the debuging stage then you can either put a limit on your select statement so that your tests only send out a few emails

     

    and / or

     

    set up some dummy emails accounts to your email address and adjust your sql query so those are all it finds

     

    and / or

     

    comment out the actual email statement and just substitute a display statement containing the email address so you can check your sql is giving you the expected data

     

     

  3. [!--quoteo(post=332901:date=Jan 3 2006, 09:42 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jan 3 2006, 09:42 PM) 332901[/snapback][/div][div class=\'quotemain\'][!--quotec--]

    I assume you mean [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=82506\" target=\"_blank\"]this topic[/a], but there's no post there!?!?

     

     

     

    whooooops, so any answers to my question.............

  4. [!--quoteo(post=332840:date=Jan 3 2006, 07:49 PM:name=thegraingers)--][div class=\'quotetop\']QUOTE(thegraingers @ Jan 3 2006, 07:49 PM) 332840[/snapback][/div][div class=\'quotemain\'][!--quotec--]

    no

     

    The error follows a select statement, sometimes on the same table the error is found in, which finds no matching rows

  5. [!--quoteo(post=332837:date=Jan 3 2006, 07:46 PM:name=LazyJones)--][div class=\'quotetop\']QUOTE(LazyJones @ Jan 3 2006, 07:46 PM) 332837[/snapback][/div][div class=\'quotemain\'][!--quotec--]

    So are you trying to insert 0 into that field then?

     

    no

  6. [!--quoteo(post=332824:date=Jan 3 2006, 07:16 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jan 3 2006, 07:16 PM) 332824[/snapback][/div][div class=\'quotemain\'][!--quotec--]

    Did/do you have zero-valued UIDs in these tables?

     

    no, in both tables the lowest auto increment value present is 1

  7. [!--quoteo(post=332808:date=Jan 3 2006, 06:39 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jan 3 2006, 06:39 PM) 332808[/snapback][/div][div class=\'quotemain\'][!--quotec--]

    When you do receive these errors? When you run CHECK TABLES? I'm not sure I really understand the error message either, though it's possible that you have auto_increment values of 0 in your tables, which are strictly allowed, but no desired. Please clarify.

     

     

    Yes the error is showing up when I do a check table.

    I have an automated check on a number of tables in place following some other errors which were occuring a few months ago

  8. I am using php/mysql widely on my web site and two of my tables keep getting the following error

     

    "Auto-increment value: 0 is smaller than max used value....."

     

    Which is fixed by repairing the table.

     

    This is happening a few times a week and I am keen to identify the problem and fix it, any clues welcomed, thanks

×
×
  • 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.