Hi all,

Following up my earlier question, since no replies:

I want to use SQLite's html output option to deliver query results as a series of HTML rows. But I also want to insert extra HTML tags in the output. How can this be done?

Example:

CREATE TABLE Payroll(name TEXT,age INTEGER,rate REAL);
INSERT INTO Payroll VALUES('Mickey',59,25);
INSERT INTO Payroll VALUES('Donald',54,22.55);

I want to ... get this:

<TR><TD>Mickey</TD>
<TD><P ALIGN=RIGHT>59</TD>
<TD><P ALIGN=RIGHT><B> $25</B></P></TD>
</TR>
<TR><TD>Donald</TD>
<TD><P ALIGN=RIGHT>54</TD>
<TD><P ALIGN=RIGHT><B> $22.55</B></P></TD>
</TR>

I now think this can't be done (using sqlite's .mode html output). So I think I'll have to create all the html code output myself and output each row of HTML as one column. For example:

CREATE TABLE Payroll(name TEXT,age INTEGER,rate REAL);
INSERT INTO Payroll VALUES('Mickey',59,25);
INSERT INTO Payroll VALUES('Donald',54,22.55);
SELECT '<TR><TD>' || name || '</TD><TD><P ALIGN=RIGHT>' || age || '</ TD><TD><P ALIGN=RIGHT><B> $' || rate || '</B></P></TD></TR>' FROM Payroll;

Which gives the desired:

<TR><TD>Mickey</TD>
<TD><P ALIGN=RIGHT>59</TD>
<TD><P ALIGN=RIGHT><B> $25</B></P></TD>
</TR>
<TR><TD>Donald</TD>
<TD><P ALIGN=RIGHT>54</TD>
<TD><P ALIGN=RIGHT><B> $22.55</B></P></TD>
</TR>

But, then I need an alternate way to convert a few characters (at least & and <) in the fields in my output into the correct html codes. How can I do this?

Thanks,
Tom

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to