How to connect mssql server in PHP
This Questions are i got from one of my friend S.Periyasamy. Now he is working as a PHP software developer at SST Software International, Kottivakkam.
1. How to Install a Flash Plugin in Internet Explorer 6 ?
http://www.ehow.com/how_4809424_install-flash-plugin-internet-explorer.html
2. How to enable ActiveX controls in Internet Explorer 6 ?
http://www.downloadatoz.com/windows-registry/faq,how-to-enable-activex-controls-in-internet-explorer-6.html
3. How to develop Variables name as dynamically?
->For example we have define variable name through loop.
for ($i = 1; $i <= $total_fields; $i++ ) {
${"data_$i"} = file_get_contents($page_id.′_′.$i.′.html′); //$data_1,_2,_3.....
if ( $i != $total_fields ) {
${"contents_$i"} = getPageContents($page_id,$i); //$contents_1,_2,_3.....
}
}
http://us3.php.net/manual/en/language.variables.variable.php
4. How to connect mssql server in PHP?
Ex:
$myServer = "localhost";
$myUser = "your_name";
$myPass = "your_password";
$myDB = "examples";
//connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn′t connect to SQL Server on $myServer");
//select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
or die("Couldn′t open database $myDB");
//declare the SQL statement that will query the database
$query = "SELECT id, name, year ";
$query .= "FROM cars ";
$query .= "WHERE name=′BMW′";
//execute the SQL query and return records
$result = mssql_query($query);
$numRows = mssql_num_rows($result);
echo "<h1>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>";
//display the results
while($row = mssql_fetch_array($result))
{
echo "<li>" . $row["id"] . $row["name"] . $row["year"] . "</li>";
}
//close the connection
mssql_close($dbhandle);
?>
5. How to get mssql error message in PHP?
mssql_get_last_message();
but when i using this code in my linux server mssql_connect cant connect