It seems like the simplest code in the world and it works too but then when I refresh... it doesn't.... odd indeed. I will then go back onto the site 5/10 minutes later and it will work again... until I refresh.... then it doesn't. Very frustrating....
I guess it is something I am not doing which is then leaving the connection open for some reason even though I close it down at the bottom of the script. The only reference I can find at all is that it will return false if the connection already exists....
Any ideas anybody?
Thanks
Tom.
<?php
##TitleQuick list of blog entries from SQL Server DB...
$myServer = "***.***.***.***";
$myUser = "********";
$myPass = "********";
$myDB = "********";
$s = @mssql_connect($myServer, $myUser, $myPass)
or die("Boom, Can't even connect to the server!.");
echo "Connected to $myServer<br />";
$d = @mssql_select_db($myDB, $s)
or die("Boom, shackalak. db select failed.");
echo "Connected to $myDB<br />";
$query = "SELECT Title, blogid FROM Blog";
$result = mssql_query($query);
$numRows = mssql_num_rows($result);
echo "<h1>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>";
$text = "<table border=0>";
while($row = mssql_fetch_array($result))
{
$text .= "<tr><td>" . $row["blogid"] . "</td><td>" . $row["Title"] . "</td></tr>";
}
$text .= "</table>";
#Close the connection...
mssql_close($s);
echo "Disconnected from $myServer<br />";
#Print the result.
echo $text;
?>
Enter your message below
Sign in or Join us (it's free).