Announcement

Collapse
No announcement yet.

Coding Question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Coding Question



    Okay, I thought I had everything working perfect but....
    Anyway this code is suppposed to go through the database, starting from the
    last record enter and check the "cover" field, if the cover field equals
    "yes" it's supposed to display it. When the latest record added has a
    "cover" field of "no" the script works perfectly. It'll go to the next
    record and if that one's field equals "yes" it will display it perfectly,
    but if the latest record entered has a cover field of "yes" then I get this
    error: "html/homepage-text.mv: Line 57: Syntax Error: Unexpected
    </MvWHILE> "
    I've have it currently coded it like this:

    <MvOPEN
    NAME = "my_db"
    DATABASE = "features.dbf"
    INDEXES = "database_yr_features.mvx"
    TYPE="xbase3">
    <MvWHILE EXPRESSION = "{my_db.d.eof NE 1}">
    <MvIF EXPR="{ my_db.d.cover NE 'yes' }">


    <MvSKIP name="my_db">
    </MvWHILE>


    <MvELSE>

    <table border="0" cellpadding="0" cellspacing="0" width="90%">
    <tr>
    <td colspan="2">[img]../feature-images/&[my_db.d.image9][/img]
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <div align="left">
    <font size="1" face="Verdana" color="#ffffff"><MvEVALUATE EXPRESSION
    = "{my_db.d.desc}">

    </font>MORE</font></div>
    </td>
    </tr>



    <MvCLOSE name="my_db">
    </MvIF>


    But I've also had it coded like this:

    <MvOPEN
    NAME = "my_db"
    DATABASE = "features.dbf"
    INDEXES = "database_yr_features.mvx"
    TYPE="xbase3">
    <MvWHILE EXPRESSION = "{my_db.d.eof NE 1}">
    <MvIF EXPR="{ my_db.d.cover EQ 'yes' }">

    <table border="0" cellpadding="0" cellspacing="0" width="90%">
    <tr>
    <td colspan="2">[img]../feature-images/&[my_db.d.image9][/img]
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <div align="left">
    <font size="1" face="Verdana" color="#ffffff"><MvEVALUATE EXPRESSION
    = "{my_db.d.desc}">

    </font>MORE</font></div>
    </td>
    </tr>

    <MvCLOSE name="my_db">

    <MvELSE>

    <MvSKIP name="my_db">
    </MvWHILE>

    </MvIF>

    And I still get the same error, of course in a different line number now.
    What am I doing wrong???


    __________________________________________________ ___________________________________
    Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com


    #2
    Coding Question



    The problem is you can't split/nest whiles and ifs.

    Here's some pseudocode that should work:

    open the DB.
    <MvOPEN yada yada yada...>

    skip until you find one, or you hit the end of the file.
    <MvWHILE EXPR="{(NOT my_db.d.EOF) AND (my_db.d.cover NE 'yes')}">
    <MvSKIP NAME="my_db" ROWS="1">
    </MvWHILE>

    If you're done skipping, and you haven't hit EOF, then you found one.
    <MvIF EXPR="{NOT my_db.d.EOF}">
    html code to show cover
    <MvELSE>
    Hmmmm... you forgot to say what you want it to do if NONE of the
    records have a cover. If nothing, then lose the MvELSE
    </MvIF>

    either way, your job is done now, so close the DB.
    <MvCLOSE NAME="my_db">


    cartel x wrote:
    >
    > Okay, I thought I had everything working perfect but....
    > Anyway this code is suppposed to go through the database, starting from the
    > last record enter and check the "cover" field, if the cover field equals
    > "yes" it's supposed to display it. When the latest record added has a
    > "cover" field of "no" the script works perfectly. It'll go to the next
    > record and if that one's field equals "yes" it will display it perfectly,
    > but if the latest record entered has a cover field of "yes" then I get this
    > error: "html/homepage-text.mv: Line 57: Syntax Error: Unexpected
    > </MvWHILE> "
    > I've have it currently coded it like this:
    >
    > <MvOPEN
    > NAME = "my_db"
    > DATABASE = "features.dbf"
    > INDEXES = "database_yr_features.mvx"
    > TYPE="xbase3">
    > <MvWHILE EXPRESSION = "{my_db.d.eof NE 1}">
    > <MvIF EXPR="{ my_db.d.cover NE 'yes' }">
    >
    > <MvSKIP name="my_db">
    > </MvWHILE>
    >
    > <MvELSE>
    >
    > <table border="0" cellpadding="0" cellspacing="0" width="90%">
    > <tr>
    > <td colspan="2"> width="300" src="../feature-images/&[my_db.d.image9]" border="0">
    > </td>
    > </tr>
    > <tr>
    > <td colspan="2">
    > <div align="left">
    > <font size="1" face="Verdana" color="#ffffff"><MvEVALUATE EXPRESSION
    > = "{my_db.d.desc}">

    > </font> face="Verdana">MORE</font></div>
    > </td>
    > </tr>
    >
    > <MvCLOSE name="my_db">
    > </MvIF>
    >
    > But I've also had it coded like this:
    >
    > <MvOPEN
    > NAME = "my_db"
    > DATABASE = "features.dbf"
    > INDEXES = "database_yr_features.mvx"
    > TYPE="xbase3">
    > <MvWHILE EXPRESSION = "{my_db.d.eof NE 1}">
    > <MvIF EXPR="{ my_db.d.cover EQ 'yes' }">
    >
    > <table border="0" cellpadding="0" cellspacing="0" width="90%">
    > <tr>
    > <td colspan="2"> width="300" src="../feature-images/&[my_db.d.image9]" border="0">
    > </td>
    > </tr>
    > <tr>
    > <td colspan="2">
    > <div align="left">
    > <font size="1" face="Verdana" color="#ffffff"><MvEVALUATE EXPRESSION
    > = "{my_db.d.desc}">

    > </font> face="Verdana">MORE</font></div>
    > </td>
    > </tr>
    >
    > <MvCLOSE name="my_db">
    >
    > <MvELSE>
    >
    > <MvSKIP name="my_db">
    > </MvWHILE>
    >
    > </MvIF>
    >
    > And I still get the same error, of course in a different line number now.
    > What am I doing wrong???
    >
    > __________________________________________________ ___________________________________
    > Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com
    >

    Comment

    Working...
    X