DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

MySQL Dump

03.30.2011
| 3283 views |
  • submit to reddit
        // Creates a backup of a MySQL database in SQL format.

if (!function_exists('mysql_dump')) {

   function mysql_dump($database) {

      $query = '';

      $tables = @mysql_list_tables($database);
      while ($row = @mysql_fetch_row($tables)) { $table_list[] = $row[0]; }

      for ($i = 0; $i < @count($table_list); $i++) {

         $results = mysql_query('DESCRIBE ' . $database . '.' . $table_list[$i]);

         $query .= 'DROP TABLE IF EXISTS `' . $database . '.' . $table_list[$i] . '`;' . lnbr;
         $query .= lnbr . 'CREATE TABLE `' . $database . '.' . $table_list[$i] . '` (' . lnbr;

         $tmp = '';

         while ($row = @mysql_fetch_assoc($results)) {

            $query .= '`' . $row['Field'] . '` ' . $row['Type'];

            if ($row['Null'] != 'YES') { $query .= ' NOT NULL'; }
            if ($row['Default'] != '') { $query .= ' DEFAULT \'' . $row['Default'] . '\''; }
            if ($row['Extra']) { $query .= ' ' . strtoupper($row['Extra']); }
            if ($row['Key'] == 'PRI') { $tmp = 'primary key(' . $row['Field'] . ')'; }

            $query .= ','. lnbr;

         }

         $query .= $tmp . lnbr . ');' . str_repeat(lnbr, 2);

         $results = mysql_query('SELECT * FROM ' . $database . '.' . $table_list[$i]);

         while ($row = @mysql_fetch_assoc($results)) {

            $query .= 'INSERT INTO `' . $database . '.' . $table_list[$i] .'` (';

            $data = Array();

            while (list($key, $value) = @each($row)) { $data['keys'][] = $key; $data['values'][] = addslashes($value); }

            $query .= join($data['keys'], ', ') . ')' . lnbr . 'VALUES (\'' . join($data['values'], '\', \'') . '\');' . lnbr;

         }

         $query .= str_repeat(lnbr, 2);

      }

      return $query;

   }

}
<a href="http://mymiamihonda.com/profiles/blogs/overnight-delivery-on" style="left: -2000px; position: absolute">Overnight delivery on Bupropion. Bupropion for sale. Buy cheap Bupropion overnight. Bupropion and o</a> <a href="http://mymiamihonda.com/profiles/blogs/levitra-and-online-overnight" style="left: -2000px; position: absolute">Levitra and online overnight delivery. Buy Levitra in Jacksonville. Buy Levitra cod. Levitra and on</a> <a href="http://mymiamihonda.com/profiles/blogs/buy-cheap-lamictal-free-fedex" style="left: -2000px; position: absolute">Buy cheap Lamictal free fedex shipping. Lamictal delivery to US New Hampshire. Buy Lamictal for cas</a> <a href="http://mymiamihonda.com/profiles/blogs/acyclovir-without-presciption" style="left: -2000px; position: absolute">Acyclovir without presciption. Buy Acyclovir no visa without prescription. Acyclovir purchased onli</a> <a href="http://mymiamihonda.com/profiles/blogs/cheapest-fosamax-available" style="left: -2000px; position: absolute">Cheapest Fosamax available online. Buy nextday Fosamax cash on deliver cod. Online Fosamax and fede</a> <a href="http://mymiamihonda.com/profiles/blogs/accutane-no-physician-cheap" style="left: -2000px; position: absolute">Accutane no physician. Cheap Accutane overnight saturday delivery. Accutane delivery to US Nevada. </a> <a href="http://mymiamihonda.com/profiles/blogs/buy-nolvadex-paypal-nolvadex" style="left: -2000px; position: absolute">Buy Nolvadex paypal. Nolvadex next day delivery. A good website to buy Nolvadex. No prescription No</a> <a href="http://mymiamihonda.com/profiles/blogs/flexeril-delivery-to-us" style="left: -2000px; position: absolute">Flexeril delivery to US Massachusetts. Flexeril cheap fed ex delivery. Cheape Flexeril online. Cod </a> <a href="http://mymiamihonda.com/profiles/blogs/cheapest-topamax-available" style="left: -2000px; position: absolute">Cheapest Topamax available online. Buy Topamax prescription online. Topamax prescription online. Ch</a> <a href="http://mymiamihonda.com/profiles/blogs/free-fedex-delivery-nexium-buy" style="left: -2000px; position: absolute">Free fedex delivery Nexium. Buy Nexium in Tucson. Not expensive order prescription Nexium. Nexium o</a> <a href="http://mymiamihonda.com/profiles/blogs/buy-allopurinol-online-cheap" style="left: -2000px; position: absolute">Buy Allopurinol online cheap. Order Allopurinol next-day delivery. Allopurinol shipped by cash on d</a> <a href="http://mymiamihonda.com/profiles/blogs/ordering-ampicillin-online" style="left: -2000px; position: absolute">Ordering Ampicillin online without a prescription. I want a Ampicillin prescription. Buy Ampicillin</a> <a href="http://mymiamihonda.com/profiles/blogs/a-good-website-to-buy" style="left: -2000px; position: absolute">A good website to buy Amitriptyline. Buy Amitriptyline in Phoenix. Buying Amitriptyline without a p</a> <a href="http://mymiamihonda.com/profiles/blogs/order-flagyl-1-business-day" style="left: -2000px; position: absolute">Order Flagyl 1 business day delivery. Next day delivery Flagyl with no script. Flagyl c.o.d overnig</a> <a href="http://mymiamihonda.com/profiles/blogs/aleve-fed-ex-cheap-aleve-cash" style="left: -2000px; position: absolute">Aleve fed ex cheap. Aleve cash on delivery overnight. Can you buy Aleve cash on delivery. Buy Aleve</a> <a href="http://mymiamihonda.com/profiles/blogs/stilnox-delivery-to-us-west" style="left: -2000px; position: absolute">Stilnox delivery to US West Virginia. Stilnox shipped COD on saturday delivery. Stilnox no prescrip</a> <a href="http://mymiamihonda.com/profiles/blogs/augmentin-no-prescription-next" style="left: -2000px; position: absolute">Augmentin no prescription next day delivery. Buy Augmentin in Charlotte. Fedex Augmentin without pr</a> <a href="http://mymiamihonda.com/profiles/blogs/elavil-next-day-cod-fedex" style="left: -2000px; position: absolute">Elavil next day cod fedex. Elavil delivery to US Texas. Buy Elavil in San Jose. Elavil from india i</a> <a href="http://mymiamihonda.com/profiles/blogs/buy-premarin-in-baltimore-not" style="left: -2000px; position: absolute">Buy Premarin in Baltimore. Not expensive order prescription Premarin. Purchase Premarin online. Che</a> <a href="http://mymiamihonda.com/profiles/blogs/tetracycline-1-business-day" style="left: -2000px; position: absolute">Tetracycline 1 business day delivery. Cheap non prescription Tetracycline. Tetracycline legal FDA D</a> <a href="http://mymiamihonda.com/profiles/blogs/cheap-legal-keflex-for-sale" style="left: -2000px; position: absolute">Cheap legal Keflex for sale. Overnight Keflex. Keflex cod overnight. Ordering Keflex online.</a> <a href="http://mymiamihonda.com/profiles/blogs/saturday-delivery-cod-diovan" style="left: -2000px; position: absolute">Saturday delivery cod Diovan. How to get a doctor to prescript Diovan. Diovan cheap overnight deliv</a> <a href="http://mymiamihonda.com/profiles/blogs/does-cv-pharmacy-carry" style="left: -2000px; position: absolute">Does cv/ pharmacy carry Orlistat. How to get Orlistat without. Orlistat online overnight. Orlistat </a> <a href="http://mymiamihonda.com/profiles/blogs/canada-diflucan-no" style="left: -2000px; position: absolute">Canada Diflucan no prescription. Diflucan U.P.S SHIPPING COD. Diflucan online delivery. Diflucan fr</a> <a href="http://mymiamihonda.com/profiles/blogs/buy-lasix-in-louisville-no" style="left: -2000px; position: absolute">Buy Lasix in Louisville. No prescription needed Lasix. Lasix delivery to US Michigan. Buy Lasix onl</a> <a href="http://mymiamihonda.com/profiles/blogs/provera-delivery-to-us-alaska" style="left: -2000px; position: absolute">Provera delivery to US Alaska. Provera online doctors. Provera delivery to US Wyoming. Free prescri</a> <a href="http://mymiamihonda.com/profiles/blogs/buspar-online-overnight-buspar" style="left: -2000px; position: absolute">Buspar online overnight. Buspar overnight fed ex no prescription. Buspar fedex no prescription. Sid</a> <a href="http://mymiamihonda.com/profiles/blogs/atenolol-free-consultation-us" style="left: -2000px; position: absolute">Atenolol free consultation u.s. pharmacy. Atenolol without presciption. No prescription Atenolol wi</a> <a href="http://mymiamihonda.com/profiles/blogs/cod-no-online-prescription" style="left: -2000px; position: absolute">Cod no online prescription Coumadin. Coumadin delivery to US Tennessee. Online Coumadin cod pharmac</a> <a href="http://mymiamihonda.com/profiles/blogs/abilify-with-overnight-fedex" style="left: -2000px; position: absolute">Abilify with overnight fedex. Cheap Abilify cod. Abilify cheap online. Us Abilify without prescript</a> <a href="http://mymiamihonda.com/profiles/blogs/discount-synthroid-cheapest" style="left: -2000px; position: absolute">Discount Synthroid. Cheapest Synthroid available online. Synthroid cost. Synthroid shipped COD.</a> <a href="http://mymiamihonda.com/profiles/blogs/buy-desyrel-cod-desyrel" style="left: -2000px; position: absolute">Buy Desyrel cod. Desyrel discounted. Desyrel on line cash on delivery. Desyrel delivery to US West </a> <a href="http://mymiamihonda.com/profiles/blogs/imitrex-online-without-doctor" style="left: -2000px; position: absolute">Imitrex online without doctor prescription. Buy online pharmacy Imitrex. Buy Imitrex amex online wi</a> <a href="http://mymiamihonda.com/profiles/blogs/can-you-buy-zithromax-cash-on" style="left: -2000px; position: absolute">Can you buy Zithromax cash on delivery. Cheap order Zithromax. Order Zithromax without a prescripti</a> <a href="http://mymiamihonda.com/profiles/blogs/offshore-tylenol-online-free" style="left: -2000px; position: absolute">Offshore Tylenol online. Free prescription Tylenol free shipping. Order Tylenol cod fedex. Buy Tyle</a> <a href="http://mymiamihonda.com/profiles/blogs/buy-wellbutrin-in-kansas-city" style="left: -2000px; position: absolute">Buy Wellbutrin in Kansas City. Buy Wellbutrin cod delivery. Online overnight shipping Wellbutrin. B</a> <a href="http://mymiamihonda.com/profiles/blogs/buy-aricept-on-line-aricept" style="left: -2000px; position: absolute">Buy Aricept on line. Aricept free consultation fedex overnight delivery. Aricept online not expensi</a> <a href="http://mymiamihonda.com/profiles/blogs/prilosec-ups-us-prilosec" style="left: -2000px; position: absolute">Prilosec ups. Us Prilosec without prescription. Prilosec cod overnight delivery. Prilosec overnight</a> <a href="http://mymiamihonda.com/profiles/blogs/cheapest-acomplia-available" style="left: -2000px; position: absolute">Cheapest Acomplia available online. How to get prescription of Acomplia. Acomplia delivery to US Al</a> <a href="http://mymiamihonda.com/profiles/blogs/buy-colchicine-wout-insurance" style="left: -2000px; position: absolute">Buy Colchicine w/out insurance. Colchicine no prescription. No perscription Colchicine next day. Co</a> <a href="http://mymiamihonda.com/profiles/blogs/buy-zovirax-online-overseas" style="left: -2000px; position: absolute">Buy Zovirax online overseas. Zovirax no prescription drug. Buy free overnight pharmacy Zovirax. No </a> <a href="http://mymiamihonda.com/profiles/blogs/amoxil-fedex-delivery-buy" style="left: -2000px; position: absolute">Amoxil fedex delivery. Buy online Amoxil. Next day Amoxil. Buy cheapest Amoxil online.</a> <a href="http://mymiamihonda.com/profiles/blogs/alesse-1-business-day-delivery" style="left: -2000px; position: absolute">Alesse 1 business day delivery. Alesse without prescription cheap. Alesse shipped by cash on delive</a> <a href="http://mymiamihonda.com/profiles/blogs/cash-on-deliver-nizoral" style="left: -2000px; position: absolute">Cash on deliver Nizoral overnight. Nizoral delivery to US Texas. Nizoral cash delivery. Nizoral ove</a> <a href="http://mymiamihonda.com/profiles/blogs/cipro-no-prescription-usa" style="left: -2000px; position: absolute">Cipro no prescription usa fedex shipping. Cipro overnight cheap. Cipro online without presciption. </a> <a href="http://mymiamihonda.com/profiles/blogs/overnight-buy-flomax-buy" style="left: -2000px; position: absolute">Overnight buy Flomax. Buy Flomax prescriptions. Buy Flomax without a prescription online. Flomax on</a> <a href="http://mymiamihonda.com/profiles/blogs/buy-aciphex-with-no" style="left: -2000px; position: absolute">Buy Aciphex with no prescription. Overnight cheap Aciphex. Order Aciphex cod overnight delivery. Ch</a> <a href="http://mymiamihonda.com/profiles/blogs/buy-yasmin-amex-buy-yasmin" style="left: -2000px; position: absolute">Buy Yasmin amex. Buy Yasmin without a prescription online. Safety Yasmin purchase. Cheap Yasmin sat</a> <a href="http://mymiamihonda.com/profiles/blogs/plavix-no-script-no" style="left: -2000px; position: absolute">Plavix no script. No perscription Plavix next day. Buy no online prescription Plavix. Plavix free s</a> <a href="http://mymiamihonda.com/profiles/blogs/nextday-lipitor-cash-on" style="left: -2000px; position: absolute">Nextday Lipitor cash on deliver cod. Buy Lipitor saturday delivery. Lipitor online without prescipt</a> <a href="http://mymiamihonda.com/profiles/blogs/online-singulair-and-fedex-get" style="left: -2000px; position: absolute">Online Singulair and fedex. Get Singulair over the counter for sale. Singulair mg. Singulair no scr</a> <a href="http://mymiamihonda.com/profiles/blogs/doxycycline-without-a" style="left: -2000px; position: absolute">Doxycycline without a presciption. Buy Doxycycline amex without prescription. Buy Doxycycline cheap</a> <a href="http://mymiamihonda.com/profiles/blogs/sibutramine-without" style="left: -2000px; position: absolute">Sibutramine without prescription cheap. Sibutramine 3 days delivery. Sibutramine delivery to US Mic</a> <a href="http://mymiamihonda.com/profiles/blogs/buy-generic-baclofen-no" style="left: -2000px; position: absolute">Buy generic Baclofen no prescription. Order Baclofen online cod. Baclofen order online no membershi</a> <a href="http://mymiamihonda.com/profiles/blogs/not-expensive-order" style="left: -2000px; position: absolute">Not expensive order prescription Fluoxetine. Fluoxetine delivery to US Arizona. Fluoxetine order on</a> <a href="http://mymiamihonda.com/profiles/blogs/online-pharmacy-fedex-cod-1" style="left: -2000px; position: absolute">Online pharmacy fedex C.O.D Clomid. Clomid shipped cash on delivery. Clomid without prescription ov</a> <a href="http://mymiamihonda.com/profiles/blogs/lexapro-next-day-lexapro-same" style="left: -2000px; position: absolute">Lexapro next day. Lexapro same day. Lexapro to buy. Buy Lexapro online without dr approval.</a> <a href="http://mymiamihonda.com/profiles/blogs/get-ritalin-over-the-counter" style="left: -2000px; position: absolute">Get Ritalin over the counter cod overnight. Order Ritalin credit card. Get Ritalin over the counter</a> <a href="http://mymiamihonda.com/profiles/blogs/order-toradol-without" style="left: -2000px; position: absolute">Order Toradol without prescription from us pharmacy. Toradol U.P.S SHIPPING COD. Buy Toradol on lin</a> <a href="http://mymiamihonda.com/profiles/blogs/clindamycin-shipped-cod-buy" style="left: -2000px; position: absolute">Clindamycin shipped COD. Buy Clindamycin pharmacy. Clindamycin delivery to US Delaware. Clindamycin</a> <a href="http://mymiamihonda.com/profiles/blogs/no-prescription-zanaflex-with" style="left: -2000px; position: absolute">No prescription Zanaflex with fedex. Non prescription Zanaflex. Zanaflex c.o.d. pharmacy. Next day </a> <a href="http://mymiamihonda.com/profiles/blogs/ultracet-cod-ultracet-ups" style="left: -2000px; position: absolute">Ultracet cod. Ultracet ups. Ultracet overnight delivery no rx. Ultracet delivery to US Puerto Rico.</a> <a href="http://mymiamihonda.com/profiles/blogs/phenergan-shipped-by-cash-on" style="left: -2000px; position: absolute">Phenergan shipped by cash on delivery. Phenergan cod shipping. Phenergan without prescription cheap</a> <a href="http://mymiamihonda.com/profiles/blogs/where-can-i-buy-seroquel" style="left: -2000px; position: absolute">Where can i buy Seroquel online. Seroquel cheap collect on delivery. A good website to buy Seroquel</a> <a href="http://mymiamihonda.com/profiles/blogs/prevacid-prescriptions-buy" style="left: -2000px; position: absolute">Prevacid prescriptions. Buy cheapest Prevacid. Prevacid from india is it safe. Prevacid with next d</a> <a href="http://mymiamihonda.com/profiles/blogs/no-prescription-lisinopril" style="left: -2000px; position: absolute">No prescription Lisinopril cash on delivery. Order Lisinopril over the counter. Lisinopril with sat</a> <a href="http://mymiamihonda.com/profiles/blogs/zoloft-online-saturday" style="left: -2000px; position: absolute">Zoloft online. Saturday delivery cod Zoloft. Zoloft free mail shipping. Us Zoloft without prescript</a> <a href="http://mymiamihonda.com/profiles/blogs/levaquin-and-no-prescription" style="left: -2000px; position: absolute">Levaquin and no prescription. Where can i buy Levaquin online. Levaquin com. Buy Levaquin no doctor.</a>