Search code examples
phpsqlvisual-foxpro

Visual FoxPro database, spaces in displayed data


I have some problem with removing spaces in my DB response... i.e data in table is second - ____________________1 by underline I mean spaces... but I can't remove those spaces when I display my data... How can I do it?

I have been tryed TRIM(), LTRIM(), ALLTRIM(), REPLACE(), STRREPLACE(), but they are not working with my visual fox pro database...

Can anyone help me with my problem?

UPD: Now I just display with print_r() command... but here is some code:

$result = odbc_exec($connect, "select
                                        pacienti.pacientid,
                                        pacienti.f_name,
                                        pacienti.s_name,
                                        napravlenie.rtgapparat,
                                        napravlenie.doctor,
                                        opisanie_rtg.opis,
                                        apparatura.prefiks
                                    from
                                        pacienti left outer join napravlenie on pacienti.pacientid = napravlenie.pacientid
                                            left outer join opisanie_rtg on pacienti.pacientid = opisanie_rtg.pacientid
                                                left outer join apparatura on napravlenie.rtgapparat = STUFF(apparatura.gruppa, 0, ' ', '')
                                    where
                                        pacienti.pacientid = '".$pk_full."'") or die ("Error in Database: ".odbc_errormsg());

    $all = array();
    while($row = odbc_fetch_array($result))
    {
        $all[] = $row;
    }

    echo "<pre>";
    print_r($all);

Solution

  • Try STRTRAN(string_field, ' ','')