Hello dear daniweb experts, i was searching over the web and couldn't find any good explenation on how to write properly to a Microsoft SQL server database, so i decided to ask the experts here:

How to properly write to the sql database:
i used this snipped to read:

//Start connection

      $cs = mssql_connect ( 'BETADEV-8752AC8:15779', 'sa', 'cc830522' ) or die ( 'Can not connect to server' );

      mssql_select_db ( '[rxjhaccount]', $cs ) or die ( 'Can not select database' );

      $sql = "SELECT * FROM [TBL_ACCOUNT]";

      $r = mssql_query ( $sql, $cs ) or die ( 'Query Error' );

      while ( $row = mssql_fetch_array ( $r ) )


      echo '$row';

	echo "All went accordint to plan";

but no results ware even displayed.
Here are some screens:

My server:

My Database:

So my question is how to properly read the values stored in TBL_ACCOUNT under the row "FLD_ID". Thanks in advance:

Recommended Answers

All 2 Replies

on line 17 you have "echo $row". I dont believe this will echo the row unless it knows what column to echo. so if you want username it would be

echo $row['username'];
// Create a link to MSSQL
$link = mssql_connect('servername', 'username', 'password');

// Select the database 'php'
mssql_select_db('databasename', $link);

i think connect to sql server use above code.

see this link for more information about microsoft sql server in php.

hope this will helpful to you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.