Perhaps you should try and do some error checking on the mysql_select_db()
function, like printing out mysql_error().

Also, for the permissions issues, mysql has a very comprehensive online
documentation on user permissions.  Check them out, you may also wish to try
and connect to the database with a different user?
http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#Adding_users

HTH
-Brad

Stephen wrote:

> Hello,
>
> I just recently switched to IIS from Apache since IIS came with Windows XP
> and I just love Microsoft. I installed PHP and MySQL with no problems but
> when I tried accessing a table, I got this error:
>
> No Database Selected
>
> In my script, I have this:
>
> $hostname_default = "localhost";
> $database_default = "check";
> $username_default = "root";
> $password_default = " **taken out for known reasons** ";
> $default = mysql_pconnect($hostname_default, $username_default,
> $password_default) or die(mysql_error());
> mysql_select_db($database_default, $default);
> $query_update = "SELECT * FROM updates ORDER BY `date` DESC LIMIT 1";
> $update = mysql_query($query_update, $default) or die(mysql_error());
> $row_update = mysql_fetch_assoc($update);
> $totalRows_update = mysql_num_rows($update);
>
> I don't see where it's gone wrong! My database name is check and phpMyAdmin
> can get to it just fine. Also, how can I set it up so MySQL allows the user
> name root and no password acessable through localhost? I accidently changed
> it to only allow username root, with password...
>
> Thanks,
> Stephen Craton
> http://www.melchior.us
>
> "What is a dreamer that can not persevere?" -- http://www.melchior.us
>
>   ------------------------------------------------------------------------
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to