Getting junk data from MS SQL Server 2008 R2 using PHP 5.3.16


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Getting junk data from MS SQL Server 2008 R2 using PHP 5.3.16
# 1  
Old 01-03-2014
Getting junk data from MS SQL Server 2008 R2 using PHP 5.3.16

Hey!!!

I am just trying to connect MS SQL Server 2008 R2 from PHP Version 5.3.16 using IIS 7.0.

I am able to connect my MS Sql Server but I am getting junk data eventhough there is a valid data exists. I don't know what is the reason for that. Below is my code snippet.

Code:
$conn = odbc_connect("Driver={SQL Server Native Client 10.0};Server=$server;Database=$db;", 'xxxxx', 'xxxxx');
    $rs = odbc_exec($conn,$strSQL);
    if (!$rs){
        exit("Error in SQL");
    }
 
    $index = 1;
    while (odbc_fetch_row ($rs)){
       echo $index . "," . odbc_result($rs, 1) . "," . odbc_result($rs, 2);
       $index++;
    }

Below is my output when I execute the above code:

Code:
1,ćuser,xuY
2,ćuser,xuY

Can you please help me on this?

Thanks in advance,

Cheers,
-R
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell to SQL for data

Input: Table: TAB1 CHILD PARENT SS MID MNM VNM RULE FLG 1 ? S1 ? ? V1 rule004 I 2 1 S1 ? ? V1 0 Z 3 1 S1 ? ? V1 1 Z 4 2 S1 ? ? V2 rule001 N 5 4 S1 ? ? V2 -999999999 to 20000 OR Missing Z 6 4 S1 ? ? V2 20000.000001 to 999999999 Z ... (3 Replies)
Discussion started by: gksenthilkumar
3 Replies

2. Shell Programming and Scripting

Junk character appearing after downloading the file from windows server

Hello, Im downloading the file from windows server through FTP, the downloaded file is containing some junk character at very start of the file as below and causing my whole script is to fail, how to download without junk or how to remove these before processing it? ▒▒"nmdbfnmdsfsdf" ... (19 Replies)
Discussion started by: Riverstone
19 Replies

3. UNIX for Dummies Questions & Answers

Remove untagged and junk data from an XML

Hi All , I have seen a lot of code samples which suggest how to remove the junk data from and XML , I need a code in unix which removes the junk characters as well as the valid characters those are not in XML tags , for example my XML is as follows : <?xml version="1.0"... (6 Replies)
Discussion started by: IshuGupta
6 Replies

4. Shell Programming and Scripting

Check Junk character in sql file

Hello, I have two .sql files which I transferred from Windows to Unix (Linux Enterprise Linux Server release 5.3).I want to ensure that these two files have no junk characters in them.How do I do it in the simplest possible way? Many thanks DJ (1 Reply)
Discussion started by: Digjoy83
1 Replies

5. Red Hat

microsoft Server 2008 Active authentication to a linux server

Hi, Please could someone advise I'm trying to use winscp from a Window server 2008 R2, but i need to add the authentication key to access the linux rh 5.4 servers ? What is the best way of approaching this ? If there are any web links that could help me do this, that would be good. ... (1 Reply)
Discussion started by: venhart
1 Replies

6. Shell Programming and Scripting

How to use sql data file in unix csv file as input to an sql query from shell

Hi , I used the below script to get the sql data into csv file using unix scripting. I m getting the output into an output file but the output file is not displayed in a separe columns . #!/bin/ksh export FILE_PATH=/maav/home/xyz/abc/ rm $FILE_PATH/sample.csv sqlplus -s... (2 Replies)
Discussion started by: Nareshp
2 Replies

7. Shell Programming and Scripting

Clense Junk Data File - Using Shell or awk or sed

Hello Shell Gurus i need help in solving this puzzle. We have a junk data file that needs to be fed into the database. Need to clense the data file thru shell script. I am not a expert and so need help with Here is what i need to do on the input file -Step -1 Replace all pipes ‘|' within... (1 Reply)
Discussion started by: rimss
1 Replies

8. UNIX for Advanced & Expert Users

Shell Script to clense junk data file

Hello Shell Gurus i need help in solving this puzzle. We have a junk data file that needs to be fed into the database. Need to clense the data file thru shell script. I am not a expert and so need help with Here is what i need to do on the input file -Step -1 Replace all pipes ‘|' within... (0 Replies)
Discussion started by: rimss
0 Replies
Login or Register to Ask a Question