Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2008
    Posts
    2

    Unanswered: Formatting sql output

    let's say i do

    select field1from table;
    and output is

    data1 value
    data2 value

    I want to display this on a webpage but don't want to run another script to format this in php. Can I tell mysql to insert the php tags into the output. So basically when running above command in batch mode have mysql output be output into .php file containig something like

    <?php
    data1 value
    data2 value
    /php>

    So basically tell select sql to append certain text in certain locations to the output.
    How can this be done.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    don't even think of going there

    the best option may be to get MySQL to output XML tags, if your version doesn't then you could output the tags as
    select "<ROW><COL1>".Column1."</COL1>" as expression1, .......<COLn>".Column1."</COLn></ROW>" as expressionn from my table

    its reasonably trivial to dump data from MySQL into say a table in PHP so I'd suggest you do it that way
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Nov 2008
    Posts
    4
    <?php
    echo "data";
    <?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •