Strange data with MSSQL

Hi,
When i try to get data from the Microsoft SQL database and check the results, the values become strange numbers, instead of the data that is displayed in the sql server studio.
i don’t know what i’m doing wrong, and when i try it using an mysql database it works fine…

Here’s the code:

require(“data_connector.php”);
require(“db_sqlsrv.php”);
$serverName = “**”;

$connectionInfo = array( "UID" => "*", "PWD" => "**", "Database"=>"spaarndam");



$res = sqlsrv_connect( $serverName, $connectionInfo); // <- SS authentication

if( $res )
{
echo “Connection works!.\n”;

	echo "string";

}

else
{

    ( print_r( sqlsrv_errors(), true));
}

$data = new DataConnector($res,“SQLSrv”);

$data-> render_sql(“SELECT TOP 1000 [ROLEID]
,[DESCRIPTION]
FROM [TIMENET].[dbo].[ROLE]”);

?>
When i check the data it retrieves, its displayed as






instead of the roles i speficied in the database (Admin, employee etc…)

Can anyone tell me what i’m doing wrong?

Thnx in advance!

change your render_sql command as

$data-> render_sql(“SELECT TOP 1000 [ROLEID]
,[DESCRIPTION]
FROM [TIMENET].[dbo].[ROLE]”, “ROLEID”, “TIMENET,ROLE,DESCRIPTION”);

2nd param - id
3rd param - names of fields which you want to have in response

wow, it works! thank you!

Another question, how come the query works and when i do it with render_table it does not?
for example:
$data->render_table(“ROLES”);

this will not give me any output…

Anyone??

Same as for render-sql you need to use full format

$data->render_table(“ROLES”, “ROLEID”, “TIMENET,ROLE,DESCRIPTION”);