-added template file for populating a database table into dev_tools

This commit is contained in:
martin 2011-06-22 11:21:49 -04:00
parent 50cde2f8b0
commit 532ba46cba
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
<?php
function GenerateRandomString($p_len=20, $p_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')
{
$string = '';
for ($i = 0; $i < $p_len; $i++)
{
$pos = mt_rand(0, strlen($p_chars)-1);
$string .= $p_chars{$pos};
}
return $string;
}
$connection = pg_connect("host=localhost dbname=airtime user=airtime password=airtime");
for ($i=0; $i<1000000; $i++){
$md5 = md5($i);
$sql = "INSERT INTO cc_files (gunid, name, artist_name, track_title, album_title) VALUES ('$md5', '".md5($i."salt")."', '".md5($i."salt1")."', '".md5($i."salt2")."', '".md5($i."salt3")."')";
pg_exec($connection, $sql);
}