> Hi!
> mysql_error returns nothing...
> The error arrives while selecting the database via:
> $link = mysql_connect("host","user","passwd");
> mysql_select_db("bla", $link);
> echo $link returns always '1'!
> David Robley wrote:
>  > In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says...
>  >
>  >>So,
>  >>
>  >>I've testet all possible I found in my brain...
>  >>CGI or Apache module: same error
>  >>mysql_connect or mysql_pconnect: same error
>  >>Variing settings in php.ini: same error
>  >>
>  >>How can I solve that problem?
>  >>BTW: Here I describe it again:
>  >>Connecting to a database works well: ok
>  >>Working with that database: ok
>  >>Using the additional $link-Parameter: false
>  >>Not a valid resource id ...
>  >>
>  >>And it does not matter how many different links with different servers I
>  >>use! The resource-id is always '1'.
>  >>
>  >>Strange...
>  >>
>  >
>  > Not a valid resource ID usually means a problem with the query - in fact
>  > this might be in the FAQ. Use mysql_error() after the database query to
>  > see if mysql returns a useful error.

Guess I misread your question. However, a litle playing around with this 

$link1 = mysql_connect("localhost","a");
$link2 = mysql_connect("localhost");
echo 'Link 1: '.$link1 .'<BR>';
echo 'Link 2: '.$link2 .'<BR>';
if(mysql_select_db("test", $link1)) {
        echo 'Successful select of test<BR>';
        echo 'Failed to select test<BR>';
if(mysql_select_db("test2", $link2)) {
        echo 'Successful select of test2<BR>';
        echo 'Failed to select test2<BR>';

which gives this output
Link 1: Resource id #1
Link 2: Resource id #2
Successful select of test
Successful select of test2

seems to indicate that php is smart enough not to open a new link even if 
requested if there is already a link for the user! Removing the "a" in 
the first mysql_connect gives me two links with a resource ID of 1.

I can force errors of course by feeding a wrong username/password which 
eventually leads to a 'Not a valid resource id' error but has other error 
messages as well. You aren't by chance hiding other error responses by 
using @ or 'or die'?

David Robley
Temporary Kiwi!

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to