$dbname = "User Names Database"; $tblname = "'" . $dbname . "'"; # or $tblname = '"' . $dbname . '"'; $sql = "select USERNAME from $tblname";