Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Samuel Wood (Otto)

    (@otto42)

    ww.wp.xz.cn Admin

    There’s nothing specific about spaces that would be affected by this widget.

    However, note that if you’re outputting into HTML code, extra spaces are ignored. HTML doesn’t have the concept of using tabs or extra whitespace for additional spacing.

    Thread Starter bworley1342

    (@bworley1342)

    In the code below, notice the print statement at the end, where I would like to have multiple spaces or a tab between entries. It strips the space and tabs from the string.
    I may recode this to simply show a table instead, but for simplicity, I was just trying to have it tab over to create a space between the PartNumber and it’s price.

    This is for an internal website, so the formatting doesn’t have to be anything spectacular.

    $connection = odbc_connect("Driver={SQL Server Native Client 11.0};Server=$srvr;Database=$database",$user, $pass);
    
    $query = "SELECT PP.PartNumber
                     ,PP.Price
                     ,LEFT(REPLACE(REPLACE(PM.Description, CHAR(13), ' '), CHAR(10), ' '),45) as Description
    FROM PartPrices PP INNER JOIN PartMaster AS PM ON PM.PartNumber = PP.PartNumber
    WHERE PP.PriceCode = 'CTG'
    AND PM.SubClass <> 'PART'
    ORDER BY PM.Class, PM.SubClass";
    
    $results = odbc_exec($connection, $query);
    
    while(odbc_fetch_row($results)){
        $part= odbc_result($results, PartNumber);
        $description = odbc_result($results, Description);
        $price= number_format(odbc_result($results, price),2);
        print "$part \t $description \t $$price<br>";
    }
    ?>

    Plugin Author Samuel Wood (Otto)

    (@otto42)

    ww.wp.xz.cn Admin

    Tabs and spacing don’t work that way in HTML. You need to use a table instead.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Tab Code and spaces being ignored’ is closed to new replies.