This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# YOURID - source record | |
# yourtable - target table; | |
CREATE TEMPORARY TABLE tmp_table SELECT * FROM yourtable WHERE id=YOURID; | |
SELECT @new_id:=((SELECT id FROM yourtable ORDER BY id DESC LIMIT 1) + 1); | |
UPDATE tmp_table SET id=@new_id WHERE id =YOURID; | |
INSERT INTO yourtable SELECT * FROM tmp_table WHERE id=@new_id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -w | |
require 'simpleidn' | |
require 'getoptlong' | |
opts = GetoptLong.new( | |
[ '--help', '-h', GetoptLong::NO_ARGUMENT ], | |
[ '--unicode', '-u', GetoptLong::REQUIRED_ARGUMENT ], | |
[ '--ascii', '-a', GetoptLong::REQUIRED_ARGUMENT ] | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gunzip < database.sql.gz | mysql -u user -p database |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--[if lt IE 7]> | |
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p> | |
<![endif]--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<target name="caketest-local" description="Run CakePHP unit tests with PHPUnit and print human readable output."> | |
<exec dir="${basedir}" executable="${basedir}/app/Console/cake" output="${logdir}/caketest.log" returnProperty="test_result"> | |
<arg line="test" /> | |
<arg line="--stderr"/> | |
<arg line="--configuration=${basedir}/phpunit-coverage-text.xml" /> | |
<arg line="app" /> | |
<arg line="AllTests" /> | |
</exec> | |
<if> | |
<not> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$connectionHandler = mysql_connect("localhost","username","password"); | |
if( !$connectionHandler ) { | |
die("Connection Failed: " . mysql_error()); | |
} | |
$dbname = 'users_db'; | |
mysql_select_db($dbname); | |
//some simple select queries to test connection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PASSWORD=XXXXXX | |
HOST=XXXXXX | |
USER=XXXXXX | |
DATABASE=databasename | |
DB_FILE=dump.sql | |
EXCLUDED_TABLES=( | |
table1 | |
table2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELIMITER $$ | |
CREATE PROCEDURE DALOOP() | |
BEGIN | |
DECLARE i INT Default 1; | |
da_loop: LOOP | |
insert into tbl_stuff values(i); | |
SET i=i+1; | |
IF i=101 THEN | |
LEAVE da_loop; | |
END IF; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Custom API function to extract all products configoptions from tblproducts */ | |
if( preg_match('/^\d+$/', $_POST['pid']) ) { | |
$resource_id = mysql_query("SELECT * FROM tblproducts WHERE id='{$_POST['pid']}'"); | |
$rows = mysql_num_rows($resource_id); | |
$xml = array(); | |
$xml[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; | |
$xml[] = "<whmcsapi version=\"5.1.3\">\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Closures & Anonymous functions test */ | |
$data = array( | |
array( | |
'name' => 'John', | |
'quantity' => '15', | |
'price' => '5.00' | |
), | |
array( |
OlderNewer