Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Table Dump "show variables"

StillAwakeStillAwake Member Posts: 8
I got this function from MySQL Web Interface
http://popeye.snu.ac.kr/~smkim/mysql

It works fine for tables that have a field set as the primary key. Tables that don't, the dump is empty. Is there any way to dump a tables content that doesn't have a primary key ?
Also, I've seached the PHP manual but can't find any reference to "show variables". Where can I find some documentation?

function dump() {
global $PHP_SELF, $USERNAME, $PASSWORD, $action, $dbname, $tablename;

if( $action == "dumpTable" )
$filename = $tablename;
else
$filename = $dbname;

header("Content-disposition: filename=$filename.sql");
header("Content-type: application/octetstream");
header("Pragma: no-cache");
header("Expires: 0");

$pResult = mysql_query( "show variables" );
while( 1 ) {
$rowArray = mysql_fetch_row( $pResult );
if( $rowArray == false ) break;
if( $rowArray[0] == "basedir" )
$bindir = $rowArray[1]."bin/";
}

passthru( $bindir."mysqldump --user=$USERNAME --password=$PASSWORD $dbname $tablename" );
}

Sign In or Register to comment.