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
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)
Re: Could not locate entry in sysdatabases
Quote:
Originally Posted by manavo11
i have done that too, but not getting success :(