Results 1 to 3 of 3

Thread: Could not locate entry in sysdatabases

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Could not locate entry in sysdatabases

    hi all,
    i have a problem, i have successfully connected my PHP code to SQL Server but when i try to connect to database which is my own database then i get this error
    Code:
    Warning: mssql_select_db() [function.mssql-select-db]: message: Could not locate entry in sysdatabases for database 'mynewdb'. No entry found with that name. Make sure that the name is entered correctly. (severity 16) in C:\Program Files\EasyPHP 2.0b1\www\MSSQL\ms.php on line 10
    my code is
    Code:
    <?php
    
    
    $SQL = "SELECT * FROM Table1";
    $h = mssql_connect("USER\SQLEXPRESS","","");
    
    
    
    
    $db = mssqL_select_db("mynewdb");
    echo $db;
    $Res = mssql_query($SQL);
    echo mssql_rows_affected($h)."<br>";
    while($Row = mssql_fetch_array($Res))
    {
    	echo $Row[0]."\t".$Row[2]."<br>";
    }
    
    ?>
    but when i use any system database which is installed with SQL Server then it gets connect succssfully and works fine
    code below works fine
    Code:
     
    <?php
    
    $SQL = "SELECT * FROM sysconfigures";
    
    $h = mssql_connect("USER\SQLEXPRESS","","");
    
    echo $h;
    
    $db = mssqL_select_db("master");
    
    echo $db;
    $Res = mssql_query($SQL);
    echo mssql_rows_affected($h)."<br>";
    while($Row = mssql_fetch_array($Res))
    {
    	echo $Row[0]."\t".$Row[2]."<br>";
    }
    
    ?>
    why im not able to work with my own Database. how this problem can be resolved please help

  2. #2
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: Could not locate entry in sysdatabases

    Might not help much, but if you put the name of the database in square brackets as suggested here?

    http://uk.php.net/function.mssql-select-db (comments at the bottom)


    Has someone helped you? Then you can Rate their helpful post.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: Could not locate entry in sysdatabases

    Quote Originally Posted by manavo11
    Might not help much, but if you put the name of the database in square brackets as suggested here?

    http://uk.php.net/function.mssql-select-db (comments at the bottom)
    i have done that too, but not getting success

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width