Forum Moderators: coopster
I create this function in a file (Called functions.php)
function connectToDB()
{
$DBServer = 'serveraddress;
$DBUsername = 'login';
$DBPass = 'password';
$DBName = 'dbName';$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
$conn->Open("PROVIDER=SQLOLEDB.1;SERVER=".$DBServer.";DATABASE=".$DBName.";UID=".$DBUsername.";PWD=".$DBPass);
$rs = $conn->Execute("SELECT * FROM caars"); // Recordset
}
And in another php file I call the function.
My problem is that when the execution query fails on the server (For example if the table doesnt exist) any following html or php code after the function call is not shown on the browser (But if the query is valid and is successfully executed it all works).
Can anybody help me? Is there anyway to display what the reason might be for the query not being executed (Some error message or something similar)? I have tried the methods on this webpage
<snip>
But didnt get any to do anything or show any error message.
As an example imagine the html file that calls the functions
<HTML><HEAD><TITLE>Test Page</TITLE></HEAD>
<BODY>
<?php connectToDB();?>This is a test webpage
</BODY>
</HTML>
If the query goes through I see the string "This is a test webpage" but if it does not I see a blank page (I'd like to see the rest of the page if possible even if the query fails and also some error message if possible).
Best Regards
NooK
[edited by: dreamcatcher at 12:27 pm (utc) on Aug. 24, 2007]
[edit reason] no urls as per T.O.S [webmasterworld.com].Thanks [/edit]