BLHTML.org

Post and database management /

 
  basket 4566 8
BLHTML's database handler for reading and writing to one or more tables.

Guidelines for basket:
  • If existing keyvalue then update post, If not then create a new post

  • basket variables:
    • $basket_command=insert new member
    • $blhtml_table editing table
    • $blhtml_erase posts to be deleted
    • $blhtml_basket return error codes from basket
    SET_CATCH_PAGE sets values to basket:
    #SET_CATCH_PAGE table="data_account1 data_account2 data_account3" erase=remove#
    • SET_CATCH_PAGE set return / catch page
    • Tables data_account1, data_account2 and data_account3 going to be sent to basket for execute: (insert/update/delete)
    • Sets erase variable name that erase post/s
    SET_CATCH_PAGE set the following code:
    #DATA[blhtml_table] post=set value="data_account1 data_account2 data_account3"#
    // Sets standard value and the field-types on field in the table: data_account1, data_account2 and data_account3

    #DATA[blhtml_table] post=hidden#
    // Save $blhtml_table as <input name=blhtml_table type=hidden value="datapage1 datapage2 datapage3">

    #DATA[blhtml_erase] post=hidden value=remove#
    // string blhtml_erase is the name of the button and checkboxes that contents the information what posts shall be erased

    #DATA[remove] post=set#
    /*
    If the button #PLOPP name=remove value="Erase posts"# is sent with the form är remove="Erase posts"
    It means that all checkboxes are selected
    #DATA[remove] post=set# uncheck all checkboxes, by unsetting $remove
    */

    More information:
  • #BASKET#
  • #SET_CATCH_PAGE#
  • #READ#
  • #DATA#
  • #PLOPP#
  • attrib databas Database rights
  • Read -> write -> delete example
  •   Hantera flera checkboxar with ett field 2735 0
    Exemplet shows how you using an integer 8 bits field can handle 8 checkboxar i en datalist.

    // attribute defalt sätter vilka checkboxar som skall vara satta som standard
    #FIELDMIN name(cb) type=int8 default(0)# // Datafield som manage upp to 8 checkboxar

    // Create en valfri variablel som exekveras fore anrop of datapage "Write post":
    #$cbi=_checkbox# // Example $cbi

    #READ#<tr>
            <td>#DATA[remove] post=new prefix=id type=checkbox class=std#</td> // Kryssruta att radera post
            <td>#DATA[id] post=new prefix=id cols=2#</td> // Shows key field
            <td noWrap>
                    #DATA[cb] post=new prefix=id type=checkbox bit=0# // Kryssrutor 0 to 7
                    #DATA[cb] post=new prefix=id type=checkbox bit=1#
                    #DATA[cb] post=new prefix=id type=checkbox bit=2#
                    #DATA[cb] post=new prefix=id type=checkbox bit=3#
                    #DATA[cb] post=new prefix=id type=checkbox bit=4#
                    #DATA[cb] post=new prefix=id type=checkbox bit=5#
                    #DATA[cb] post=new prefix=id type=checkbox bit=6#
                    #DATA[cb] post=new prefix=id type=checkbox bit=7#
                    #DATA[cb_$id$cbi] post=hidden value=1# // Talar if for basket att variable $cb är en checkbox
                    #$cb# // Shows value on $cb satta with ovanstående checkboxar
            </td>
    </tr>

    More information:
      Return codes basket 1619 0
    basket returnerar variable: blhtml_basket

    Value:Bit:   description:
    delete:
    10
    21
    42
    83
    16

    4



    insert:
    2568New post skapad
    5129Fält måste vara unikt
    102410Fält får ej vara tomt
    204811
    4096

    12



    update:
    6553616Post updated
    13107217Fält måste vara unikt
    26214418Fält får ej vara tomt
    52428819
    1048576

    20



    Övriga basket messages:
    1677721624Username for kort
    3355443225Ogilltigt characters in username
    6710886426Ogilltigt username
    13421772827Wrong password
    26843545628

    More information:
  • basket
  •   Create new posts 1263 0
    Example att create new posts:
    #SET_CATCH_PAGE table=account#

    #FIELD type=last add=1 return=id#
    #DATA[pris] post=set#

    id:<br>
    #DATA[id] post=new#<br>
    Produkt:<br>
    #DATA[lager] post=new type=checkbox#<br>
    Pris:<br>
    #DATA[pris] post=new#<br><br>

    #PLOPP value(Lägg to new vara)#<br><br>

    Förklaring:
    • SET_CATCH_PAGE set return / catch page to sig själv and calling basket som saves posts som överenstämmer with table/er table=account

    • #DATA[id] post=set value(#FIELD type=last add=1#)# Sätter nyckeln to last + 1 posten in table.
    • #DATA[pris] post=set# Clears Field for writing new data.
    • #DATA[id] post=new# Denna can ersättas with en hidden if användarna ej får change nyckeln.
    • #DATA[lager] post=new type=checkbox# Matar in ett TRUE or FALSE värde.
    • #DATA[pris] post=new# Ett INPUT field for värde or text.

    • #PLOPP value(Lägg to new vara)# Skickar data for behandling
    More information:
  • basket
  • #SET_CATCH_PAGE#
  • #DATA#
  • post=set
  •   Erase posts 1519 0
    Grund att radera post/er.

    Example from datapage som list posts from databasen:
    #DATA[blhtml_erase] post=hidden value=remove#
    // #DATA[blhtml_erase]# håller name on checkboxarna and "radera post knapp"

    #DATA[remove] post=set# // Uncheck all checkboxar efterson knappen heter lika data[remove]
    /*

           Code som manipulerar databas

    */

    #PLOPP name=remove value="Erase posts"# // If knapp raderas markerade checkbocksar with samma name

    Från datapage där listobject skrivs:
    #DATA[remove] post=new prefix=id type=checkbox class=checkbox#

    // This is checkbox elementet som avgör if post skall bli raderad or not

    More information:
  • basket
  • #SET_CATCH_PAGE#
  • #BASKET#
  •   Example get, update and Insert 1397 0
    #IF(#SYSTEM[whoami]#) else(#HALT#)#
    #SET_CATCH_PAGE table=test#

    #IF($id) else(#DATA[id] post=set value=1#)#

    #PRINT size=5 value(Update table)#<br><br>

    id:<br>
    #DATA[id] post=new#
    #PLOPP name=ignore value(Get post)#<br><br>

    #READ value=$id#

    Rubric:<br>
    #DATA[rubric] post=new ink=FFFFFF paper=333333#<br>
    Message:<br>
    #DATA[msg] post=new ink=FFFFFF paper=333333#<br><br>

    #PLOPP value(Save post)#
    • If not logon don't show form!
      (Activate this page for members only Can be a better option).
    • SET_CATCH_PAGE set return / catch page to this datapage and sets basket table to test and insert / update posts that are consistent with table
    • #IF#($id) if $id no value then set $id to 1
    • #DATA[id] post=new# key value to actibe post
    • #PLOPP name=ignore value(Get post)# Get post from value set in #DATA[id] post=new#. If #PLOPP name=ignore# update the form without saves any data.

    • #READ value=$id# Read post where key field is equal to $id, else If no post with $id key value then nothing to read and no error message.
    • #DATA[rubric/msg]# rubric and msg är 2 field from current data account / table we what to update.
    • #PLOPP value(Save post)# Submitting the form to basket for execution. The attrib table set the rights who can perform what to the table test.
    More information:
  • basket
  • #SET_CATCH_PAGE#
  • attrib
  •   attrib 2086 2
    attrib Is a table that can be created in BLHTML. attrib has 3 fields:
    • id typ H8
    • user typ str(16)
    • status typ H4
    If field: "user" is not in table "attrib" then status = 0
    (then only table owner can read / write to table).

    user:description:
    AdminAdmin accounts: 1 to 99
    Ownerpost with field who = #SYSTEM[whoami]#
    MemberAccountn >= 200
    GuestNot logon, visitors
    AllAdmin, member, guest and alla

    Value:Bit:   description:
    Create new posts:
    10Admin
    21Owner
    42Member
    83Guest
    16

    4

    All

    Update posts:
    2568Admin
    5129Owner
    102410Member
    204811Guest
    4096

    12

    All

    Erase posts:
    6553616Admin
    13107217Owner
    26214418Member
    52428819Guest
    1048576

    20

    All

    Supplementary information:
    1677721624Keyvalue: is equal to whoami (logon datapage id)
    3355443225Insert IP-address to field IP
    6710886426Can only write post 1 time, save IP-address to field IP (can't update post)
    13421772827who: insert user id to field: who
    26843545628who: insert uniqe user id to field: who
    who has higher priority and takes precedence over the key value
    (If a post contain your who then you can't insert a new post only update your own who post)

    More information:
  • basket
  • BLHTML forum  


    apache MySQL PHP No to software patents! BLHTML
    © 2003, 2010 BLHTML
    This page is created with BLHTML in 0.1097 seconds