Because when phpMyAdmin is set up on a new XAMPP install it uses the same default values of username = root and no password. So If you are using this on your local PC them that is OK, but to use phpMyAdmin you must either put those values into the config.inc.php file that looks like this
// The $cfg['Servers'] array starts with $cfg['Servers'][1]. Do not use
// $cfg['Servers'][0]. You can disable a server config entry by setting host
// to ''. If you want more than one server, just copy following section
// (including $i incrementation) serveral times. There is no need to define
// full server array, just define values you need to change.
$i++;
$cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname or IP address
$cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port
$cfg['Servers'][$i]['socket'] = ''; // Path to the socket - leave blank for default socket
$cfg['Servers'][$i]['connect_type'] = 'tcp'; // How to connect to MySQL server ('tcp' or 'socket')
$cfg['Servers'][$i]['extension'] = 'mysql'; // The php MySQL extension to use ('mysql' or 'mysqli')
$cfg['Servers'][$i]['compress'] = FALSE; // Use compressed protocol for the MySQL connection
// (requires PHP >= 4.3.0)
$cfg['Servers'][$i]['controluser'] = 'pma'; // MySQL control user settings
Or through the admin to MySQL add a user with all privledges and a password. Since you are the only one using the system then it would be better to just leave it alone as is and alter your code to reflect a userneame of root
e.g.
$connect = mysql_connect('localhost', 'root');