Export MySQL to Excel Using PHP

Code, Hack on February 22nd, 2012 Comments Off

The code below will export every column name and value from your database into an excel document. Note: Delete the line spaces if you receive a parse error.  PHP |  copy code |? 01<?php02/*******EDIT LINES 3-8*******/03$DB_Server = "localhost"; //MySQL Server 04$DB_Username = "username"; //MySQL Username 05$DB_Password = "password"; //MySQL Password 06$DB_DBName = "databasename"; //MySQL Database Name 07$DB_TBLName = "tablename"; //MySQL [...]

Tags: , , ,

Find and Replace in SQL

Hack on October 20th, 2011 No Comments

This is a very useful code for making edits on the fly, especially if you have extra spacing or quotes after importing values into your database.  SQL |  copy code |? 1UPDATE tablename SET tablefield = REPLACE(tablefield,’oldstring’,'newstring’);

Tags: , ,

Update Checkbox Value Using PHP & MySQL

Hack on September 27th, 2011 No Comments

This code will send exactly two query’s to update a INT (0 or 1) checkbox field in a MySQL database. The IN operational statement let’s you match on a list of values in a clause. The implode statement will turn the array (shown below) into a string.  PHP |  copy code |? 0102<?php03 if (isset($_POST[’doSave’])){04 if (isset($_POST[’checkbox’])){05 $doSave = implode(’,',$_POST[’checkbox’]);06 [...]

Tags: , ,