Set up routines to:

a) Display x lines of table x starting at id x (or all the lines if nothing but table name given)
b) Make backup of table x to filename x
c) Restore table x from backup file x (or default backup, see below)

Then just include something which takes mySQL commands from a textarea and feeds them to the database, displaying any errors which occur as a result. Have the mySQL table automatically back itself up to another file before every set of commands, so the user can restore the database if he ruins it by mistake.

This should give someone who knows mySQL all the functionality he needs to maintain the database without complicated programming. As to actually using the database, that''s another story - you'll need something that people can include in their pages which lets them specify which fields they want displayed how:

ID=4 TABLE=PENPALS My name is <<NAME>> My email is <a href="mailto:<<EMAIL>>"><<EMAIL>></a>
ALL TABLE=PENPALS <tr><td><<NAME>></td><td><<EMAIL>></td></tr>
It would extract the field names, feed them to the database in a query, take the results, and display them. The first line could specify which or how many records of which table, and the rest of the lines would be the format to display in. Probably wouldn't be too hard to abstract.

In reply to Re: Abstracting SQL without Stored Procedures by TedPride
in thread Abstracting SQL without Stored Procedures by radiantmatrix

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.