PHP MySql routine....list each state only once

I have a db with two fields, city and state. I want to list
the states on a
page, but of course only want each state to list once. I have
the recordset
ready to go. I know this must be dirt simple....if I only
knew how.
Help?
Thanks,
Mad Dog

I have the Simulated Nested Region and thought I might be
able to fool it by
not having the second column. But no.....
Your second option (DISTINCT) is probably perfect. I'll try
it in a while. I
was going to email you directly but didn't want to be a PITA.
THANKS!
MD
Joe Makowiec wrote:
> On 09 Oct 2008 in macromedia.dreamweaver, Mad Dog wrote:
>
>> I have a db with two fields, city and state. I want
to list the
>> states on a page, but of course only want each state
to list once. I
>> have the recordset ready to go. I know this must be
dirt
>> simple....if I only knew how.
>
> You mean that you want something like:
>
> STATE
> City
> City
> STATE
> City
> ...
>
> See if this extension from Tom Muck does it for you:
>
>
http://www.tom-muck.com/extensions/help/simulatednestedregion/
>
> OR - do you just want a list of states? If so, then you
need:
>
> SELECT DISTINCT myState
> FROM myTable
> ORDER BY myState ASC
>
> And, while we're at it, list of states with count:
>
> SELECT myState, COUNT(myState) AS stateCount
> FROM myTable
> GROUP BY myState
> ORDER BY myState ASC
>
> If not, post back and we'll take care of it.

Similar Messages

  • Adding list based menu only once for all related pages

    Hi,
    I have a one level tab application. For a given tab I have 5 different pages. I would like let the end user navigate to these pages via a list region. Currently I have added to all five pages a list region and assigned the same list item to these list regions.
    Is it possible that I add this list based menu only once to my application or this is the normal way of doing it?
    Is there a way to let
    Regards,
    Tamas

    Use page zero.
    Add regions containing the lists for each tab to the same region display point on page zero, making each region conditional using a "Current Page Is Contained Within Expression 1..." condition.

  • Transformation Routine for checking condition only once

    Hello,
    I would like to perform he calculations based on certain criteria which goes like this...
          LOOP AT ITab WHERE EMPno  = ITAB Empno AND
                            ATYPE = ITAB-stype .
            IF ITAB-LTYP = '1000'.
              CHECK ITab-ABEGIN GE YR_BEGDT AND ITab-ABEGIN LE YR_ENDDT.
              CHECK FLAG_ST <> 1.
              ITAB-PENDING_ST = ITAB-PENDING_ST + ( ( ITab-BAL / 825 ) * 100 ).
            ELSEIF ITAB-STPE = '2000'.
              CHECK FLAG_SL <> 1.
              ITAB-PENDING_SL = ITAB-PENDING_ST + ( ( ITab-BAL  / 825 ) * 100 ).
              ENDLOOP.
          IF ITAB-stype  = '1000'.
            FLAG_ST = 1.
          ENDIF.
          IF ITAB-stype  = '2000'.
            FLAG_SL = 1.
          ENDIF.
          MODIFY ITAB.
    How to implement this logic in Transformation roles ... as this flag checks only once.... to perform the calculation.
    Thanks
        ENDLOOP.

    Hi there,
    You must be aware of start and end routine in a transformation.
    Assumin that you would like to modify the code before sending it to individual( field wise transormation) transformation , you can write your code in start routine tab of the transformations.
    Code written in Start routine in a transformation can manipulate the data data package wise..
    say for eg if u need to fill the values in indivual routine  then u can save all  the values in an internal table ( say for eg ur itab) in the start routine and this data is available for u in the transformation routines.. so anything written in start rotuine shall work as global modification for the transformation routines.
    Similarly code written in end rotuine shall work for chunk of data which is modified individually in transformation routine.
    you ca go thr this link for more clarification
    http://www.sdn.sap.com/irj/scn/index;jsessionid=(J2EE3417700)ID2067718350DB10090875593766856688End?rid=/library/uuid/609eea32-455e-2c10-c08a-c23adf8c934e&overridelayout=true
    http://help.sap.com/saphelp_nw04/helpdata/en/4f/a9ea964a86b04dbe4df20af6e598cf/frameset.htm
    Regards,
    kk

  • Return each value only once using cfloop query

    Hi,
    I have some code that dynamically populates a cfselect list and then populates a second list based on those values. Everything seems to be working fine, except that all values are being pulled from the database, and there are duplicates in most cases. For example, value 1S1W diplays in the drop-down menu 10 times, where I would only like it there once.
    Is there a way to have one of each value in my list?
    <cfif isDefined('form.select_Main_Group')>
        <cfset page.select_Main_Group = form.select_Main_Group>
    </cfif>
    <cfoutput>
      <form name="DropDown" method="post">
      <!--- query DB for the first drop down list --->
    <CFQUERY name="get_Main_Group" datasource="ds" dbtype="odbc">
    SELECT *
              FROM  slco_sire.dbo.area_reference_plats_doc INNER JOIN slco_sire.dbo.area_reference_plats_page
              ON    slco_sire.dbo.area_reference_plats_doc.doc_id = slco_sire.dbo.area_reference_plats_page.doc_id
              ORDER BY page_description
    </CFQUERY>
      <!--- first drop down list --->
      <!--- NOTICE the onChange javascript event in the select tag, this is what submits the form after the first selection --->
      <select name="select_Main_Group" required="yes" onchange="this.form.submit()">
         <option>Select Township/Range</option>
         <!--- dynamically populate the first drop down list based on the get_Main_Group query --->
         <!--- NOTICE the CFIF within the option tag, this says, if the first selection has been made, display the chosen option when the page reloads --->
         <cfloop query="get_Main_Group">
             <option value="#SECTION#" <cfif isDefined('form.select_Main_Group')><cfif form.select_Main_Group eq "#SECTION#">selected</cfif></cfif>>#TOWNSHIP_RANGE#</option>
               </cfloop>
    </select>
    <p>
    <!--- if the first selection has been made, display the second drop down list with the appropriate results --->
    <cfif isDefined('page.select_Main_Group')>
       <!--- query DB for second drop down list, based on the selected item from the first list --->
       <cfquery name="get_Sub_Group" datasource="ds" dbtype="odbc">
            SELECT TOWNSHIP_RANGE, SECTION
            FROM  slco_sire.dbo.area_reference_plats_doc INNER JOIN slco_sire.dbo.area_reference_plats_page
                        ON    slco_sire.dbo.area_reference_plats_doc.doc_id = slco_sire.dbo.area_reference_plats_page.doc_id
            WHERE SECTION = '#page.select_Main_Group#'
       </cfquery>
       <!--- second drop down list --->
       <select name="select_Sub_Group" required="yes">
          <option>Select Section</option>
          <!--- dynamically populate the second drop down list based on the get_Sub_Group query --->
          <cfloop query="get_Sub_Group">
             <option value="#SECTION#">#SECTION#</option>
          </cfloop>
       </select>
    </cfif>
    </form>
    </cfoutput>

    Emily,
    OK.  Yes it is possible.  Change your first query to:
    SELECT  DISTINCT TOWNSHIP_RANGE
              FROM  slco_sire.dbo.area_reference_plats_doc INNER JOIN slco_sire.dbo.area_reference_plats_page
              ON    slco_sire.dbo.area_reference_plats_doc.doc_id = slco_sire.dbo.area_reference_plats_page.doc_id
              ORDER BY TOWNSHIP_RANGE
    </CFQUERY>
    Notice I removed any mention of SECTION, because it's irrelevant to generating a unique list of TOWNSHIP_RANGE.  Also, GROUP BY is not needed, but an ORDER BY will sort the records in alphanumeric order.
    Then you need to modify your code where you generate the option list for the first pulldown:
    <option value="#get_Main_Group.TOWNSHIP_RANGE#" <cfif StrucKeyExists(form,'select_Main_Group') AND form.select_Main_Group eq "#get_Main_Group.TOWNSHIP_RANGE#">selected</cfif>>#get_Main_Group.TOWNSHIP_RANGE#</option>
    Here I did a couple of things beside changing SECTION references to TOWNSHIP_RANGE .  It's a good idea to add the query name prefix to column names when you output them so that you avoid collisions with variables that have the same name.  I also reduced your <CFIF> statements to one compound statement for simplicity, and replaced the IsDefined with a StructKeyExists function.  This is considered to be better practice and won't throw an error when used in a compound statement (if you kept the IsDefined statement and tried that in a compound selection, it can sometimes throw errors if the variable in the IsDefined doesn't exist).
    Now, your second query should be something like:
    <cfquery name="get_Sub_Group" datasource="ds" dbtype="odbc">
            SELECT DISTINCT SECTION
            FROM  slco_sire.dbo.area_reference_plats_doc INNER JOIN slco_sire.dbo.area_reference_plats_page
                        ON    slco_sire.dbo.area_reference_plats_doc.doc_id = slco_sire.dbo.area_reference_plats_page.doc_id
            WHERE TOWNSHIP_RANGE = '#page.select_Main_Group#'
            ORDER BY SECTION
       </cfquery>
    Here I changed the WHERE clause to filter based on the TOWNSHIP_RANGE you selected in the first pull-down.  This should now return a list of SECTIONs that match the TOWNSHIP_RANGE selected in the first pull-down.
    Lastly, some minor changes to the option list for the second pulldown:
      <option value="#get_Sub_Group.SECTION#">#get_Sub_Group.SECTION#</option>
    One other thing I noticed.  If you are on ColdFusion 8 or 9, the dbytpe="odbc" is no longer needed.  I'm assuming you are using an ODBC database connection to something like MS Access.  If so, you can omit the dbytype entirely.  It's only needed now if you do query-of-query queries, where it would be dbtype="query".
    HTH,
    -Carl V.

  • DB Adapter Polls each record only once.

    Hi All
    I am using DB adapter Logical delete Polling strategy in BPEL my process. Whenever new record created or updated in DB table, BPEL instance gets kicked off.
    With Logical delete strategy DB Adapter always updates table with read value(given in wizard) after consuming newly created record. Now once newly created record has been processed/consumed by DB Adapter , It will not picked up again If I update the same record. Reason: DB adapter has already marked it as 'Read'. And my Application can not reset the column marked by DB Adapeter .
    Anybody has some other idea to achieve this ?
    thanks
    /Mishit

    Why can't your application update the field again to the un-read value? It is filled initially with a not-read value isn't it? A simple update trigger on the table could do the trick. If not you should create a staging area table, if you want in an other schema, that gets records whenever an insert or update takes place on your application table. Anyway without table triggers on the original table it is not posible. Did you know you can also create a trigger from a staging area schema on a table in an other schema?
    Kind Regards,
    Andre

  • [php+mysql] nextensio list: how to change row color based on field content?

    Hi all
    I have a nextensio list on a page.
    is there a way to change the background color of a whore row based on
    a specific field content?
    example I have a field containing the values 0 or 1.
    If the field content is 1 the row background color should be RED.
    ANy suggestion?
    TIA in advance.
    tony

    DataBoundAPI's you can refer to achieve this.
    Search for OLD threads also. Here are some links:
    Can we colour the rows in the column of a table
    Advanced table row font color- result based change.
    Thanks
    --Anil
    http://oracleanil.blogspot.com/

  • Start routine: only once per teh load but not once per data packet

    Hi,
    I would like to execute some code in start routine (in update rules) only once per the load but not once per the data packet.
    How can I implement this.
    Regards,

    I once had that same requirement, but in a datasource in R3. I'm not sure if the same solution would work in BW, though. I used a memory id to keep the variable value between packets:
    DATA: ... n_globalvar TYPE n ...
    then I added...
    IMPORT n_globalvar FROM MEMORY ID 'ZMEMID01'.
    ...at the start of the routine to retrieve to the variable the value from the memory id.
    At the end of the code, I exported the variable back to the same memory id...
    EXPORT n_globalvar to MEMORY ID 'ZMEMID01'.

  • PreparedStatement vs Statement - When executing only once

    Are there any performance implications in using PreparedStatement vs
    Statement when you are executing the SQL only once? I am talking about all
    kinds of SQL (Select, Update, Insert and Delete). If PrepatedStatement is
    used, I would expect some overhead in setting values for different columns
    separately and precompliling. Is that overhead significant enough to
    degrade performance? If we execute statement only once, I do not expect to
    any gain on performance.
    I would appreciate any comments.
    Sarat

    It also depends on the database/driver combination,several database can be
    configured to maintain a prepared statement cache at the DB level (I have
    never done it myself, but I know people who has done this. Lately I use
    mostly Oracle, for which I should not be configured an expert :)).
    Also the weblogic's prepared statement cache only caches first so many
    statements. If you have used them all up at the startup you are out of luck.
    I know you already knew that, but may be helpful to the original poster.
    .raja
    "Cameron Purdy" <[email protected]> wrote in message
    news:[email protected]..
    BTW - there is a case where prepped stmts are faster -- when they arecached
    by Weblogic's jdbc wrappers. So my previous answer can be wrong.
    Peace,
    Cameron Purdy
    Tangosol Inc.
    << Tangosol Server: How Weblogic applications are customized >>
    << Download now from http://www.tangosol.com/download.jsp >>
    "sarat" <[email protected]> wrote in message
    news:3b715901$[email protected]..
    Are there any performance implications in using PreparedStatement vs
    Statement when you are executing the SQL only once? I am talking aboutall
    kinds of SQL (Select, Update, Insert and Delete). If PrepatedStatement
    is
    used, I would expect some overhead in setting values for differentcolumns
    separately and precompliling. Is that overhead significant enough to
    degrade performance? If we execute statement only once, I do not expectto
    any gain on performance.
    I would appreciate any comments.
    Sarat

  • How to search files on a Time Machine backup disk only once perfile

    Greetings,
    Goal: I want to find all user files in a set of Time Machine backups residing on a single disk that contain the string "escalator". Now, there are multiple hard links to each file, so a simple search would search each file multiple times. That would take a very long time. Is there a way that I can search (grep) all text files and mail files only once and list those that contain the string? Note that I only want to search user directories; that is,
    /Volumes/Time Machine Backups/Backups.backupdb/username’s iMac/Latest/Macintosh HD/Users
    where "Latest" can also be any of the dates of all the backups.
    Thanks!

    Well, to clarify:
    I want to find all user text files and mail messages on a Time Machine backup disk that contain the word "escalator".
    By user files I mean those in
    /Volumes/Time Machine Backups/Backups.backupdb/<username>iMac/*/Macintosh HD/Users
    and subdirectories thereof.
    I was trying to use the find command, but it was taking a very long time, so I aborted it. I then realized that most of the files have many hard links, and therefore will be searched many times. That, of course, is a great waste.
    Is there some way to search each file only once?
    Thanks.

  • Tkprof list each sql statement

    I think I registered this question once, but I cannot find it now so I'll do it again.
    I have a 10046 trace with a statement executed twice in the same session (same bind values) . I have different plans for each execution
    When formatting the sql is showed once.
    I wonder if I can make tkprof list each single execution individually, I checked the aggregate function but if I understand it
    correct it only divides sql based on users.
    Anyone who knows a tool that can do what I want or if I can do this with tkprof.
    Version is 11.2.0.3
    Appreciate your feedback.
    Thanks
    Magnus

    Hi Magnus,
    a SQL profiler can just use and interpret the traced information. In your case you have captured the following "As of 11.1 an execution plan is written to the trace file only after the first execution of every cursor. The execution statistics associated to it are the ones of the first execution only.". TKPROF itself is also able to re-compile and show an execution plan for a SQL (if not captured at all), but this is faulty due to various feature / general limitations (e.g. cardinality feedback or the general limits).
    You need to use the following trace options, if you want both execution plans (for every execution) in the raw SQL trace file for further interpretation:
    SQL> exec DBMS_MONITOR.SESSION_TRACE_ENABLE(NULL,NULL,TRUE,TRUE,'ALL_EXECUTIONS');
    Regards
    Stefan

  • Listing a join column only once in a select

    Hi.  Has there been any advancement in t-sql where I can continue to select * on tables a and b in a join but expect to get back only one occurrence of columns that r used in the join.  Or do I still need to explicitly list all cols in the
    query?
    eg.  select a.*,b.* from a inner join b on a.c = b.c
    hoping there is some shorthand way to see c only once
     

    Sorry, I would not refer your expectation with "advancement". Relational engine needs to identify each column separately in the query, user have capability to select required columns.
    If you consider LEFT OUTER JOIN, how would it decide which column to display from LEFT or RIGHT table (because when the values do not match you will still have all the rows from LEFT table).
    When you specify "*" it brings the entire result set. So you will have to do little work and select only the required column. :-)
    If this post answers your query, please click "Mark As Answer" or "Vote as Helpful".

  • PHP MySQL 2 column list

    I am building at site in dreamweaver using PHP/MySQL.
    I have a page that will list a bunch of categories. I would
    like to have them in a two column list instead of one. It will look
    better as far as the design goes. How can I do this. I would like
    each column to be an equal amount as possible

    On 13 Mar 2007 in macromedia.dreamweaver.appdev,
    newhorizonhosting.com
    wrote:
    > I have a page that will list a bunch of categories. I
    would like to
    > have them in a two column list instead of one. It will
    look better
    > as far as the design goes. How can I do this. I would
    like each
    > column to be an equal amount as possible
    Have a look at Tom Muck's Horizontal Looper extension:
    http://www.tom-muck.com/extensions/help/HorizontalLooper/
    Joe Makowiec
    http://makowiec.net/
    Email:
    http://makowiec.net/email.php

  • Display Select list only once in the report

    Hi,
    select
    CLS.NAME "Name",
    CLI.SECTION "Section",
    CLI.DESCRIPTION "Description",
    htmldb_item.select_list(5,R.REVIEWER_CONFIRM,'YES;YES,NA;NA,NO;NO') "Reviewer Confirm",
    htmldb_item.text(6,R.REVIEW_COMMENT,60,60) "Reviewer Comment",
    R.ID "ID"
    from
    CHECK_LIST_SUB CLS,
    CHECK_LIST_ITEM CLI,
    RCL R
    where
    CLS.CHECK_LIST_SUB_ID = CLI.CLS_ID
    and
    CLI.CLI_ID = R.CLI_ID and
    R.RI_ID = :P21_RI_ID
    The above query will return set of rows there is also a select list displayed for each row
    I need to restric this select list for each name wise in the result of the report.
    select list should not repeat it must be report only once
    Please suggest me how to do this
    Thanks
    Sudhir

    Sudhir,
    Try this query.
    SELECT
    CLS.NAME "Name",
    CLI.SECTION "Section",
    CLI.DESCRIPTION "Description",
    CASE WHEN ROWNUM = 1 THEN
         htmldb_item.select_list(5,R.REVIEWER_CONFIRM,'YES;YES,NA;NA,NO;NO')
         ELSE NULL
    END "Reviewer Confirm",
    htmldb_item.text(6,R.REVIEW_COMMENT,60,60) "Reviewer Comment",
    R.ID "ID"
    FROM     CHECK_LIST_SUB CLS,
         CHECK_LIST_ITEM CLI,
         RCL R
    WHERE     CLS.CHECK_LIST_SUB_ID = CLI.CLS_ID
         AND CLI.CLI_ID = R.CLI_ID
         AND R.RI_ID = :P21_RI_IDThanks,
    Manish

  • I am having an issue where whenever I am at the document list and do edit, to copy or delete a document the iPad locks up. Happens for both pages and numbers. Also happens on my iPhone, but only once in a while. Help.

    I am having an issue with both Pages and Numbers on my iPad. Whenever I am at the document list page and use "edit" to make a copy of a document or delete it, the iPad locks up. Happens almost every time. Also happens on my iPhone but only once in a while. Thought of completely redoing the iPad, but if it happens on the phone as well, won't help. ???

        Hello APVzW, we absolutely want the best path to resolution. My apologies for multiple attempts of replacing the device. We'd like to verify the order information and see if we can locate the tracking number. Please send a direct message with the order number so we can dive deeper. Here's steps to send a direct message: http://vz.to/1b8XnPy We look forward to hearing from you soon.
    WiltonA_VZW
    VZW Support
    Follow us on twitter @VZWSupport

  • Using an NDS statement for a SQL stament run only once in a proceudure

    Hi,
    We're using Oracle 11.1.0.7.0.
    I'm going through code written by someone else. In this package they're using NDS for every SQL call whether it gets called multiple times or just once. Is that a good thing?
    I thought NDS was only reserved for SQL statements that get called over and over again in a procedure with possible varying 'WHERE clause' variables and so on...
    Is there ANY benefit to using NDS for SQL queries called only once in a procedure?
    Thanks

    There is no benefit unless you want to turn PL/SQL into SQL*Plus (parse once, run once)
    Procedures exist to make sure : parse at compile time, run many times.
    The code is shooting itself in its own foot.
    Or the developer must have got hold of Tom Kyte's unpublished one chapter book 'How to write unscalable applications'.
    Sybrand Bakker
    Senior Oracle DBA

Maybe you are looking for

  • Use and update purchased apps from one iTunes store account to another?

    I have two iTunes Store Accounts (Apple ID's) with the vast majority of purchases, music and apps, made on one account, but I've created a second account and wish to use it to sync with my iPhone. Will I be able to continue to use and update the apps

  • Time Machine Not Compacting SparseBundle on Time Capsule

    Hi I am running Snow Leopard 10.6.4 and have a time capsule to hold my iTunes Library and act as my Time Machine repository. I'm experiencing the problem where Time Machine has filled up my 1TB Time Capsule, and will not back up any more. I can see t

  • Need suggestion on Data Center Migration

    Hi All, We are currently handling a datacenter migration project where in the souce instance is hosted at Oracle Datacenter ( Texas ). and the target instance need to be built on **** Hosted datacenter ( U.K). -> It takes 3days to ship the (cold) bac

  • Trasnfer function error usgin ULx library for running a DC motor

    HI, I am trying to run a DC motor using Labview's control kit. I want to add a transfer function to the system but once in the loop it gives me an error. The function has an added zero to see changes in the system. It is given by : H(s)= (1/5s +1) /

  • RFC Error while configuring SLD

    Hello Forum, I am getting RFC error as below , while configuring RFC. Before that I would like to give details about landscape. 1. I have installed NetWeaver Sneak Preview - JAVA Version on Windows 2000. This I want to make as SLD Server. I did data