How to read in data from MySQL to Authorware?

Hi,
I am trying to read in values from my database (MySQL) to
authorware, but the best I am able to get is true or false.
I would like to be able to get some data from the database
and return it to AW as a string. Does anyone have any experience
with this? Can anyone lend a helping hand in this endeavor?
Thanks in advance for your help,
Brad

"Paul Swanson" <[email protected]>
wrote in message
news:[email protected]...
> Kevin, you shouldn't need to worry about ODBC or OLEDB.
Your PHP script
> needs to handle the database connection, and you can use
PHP's
> mysql_connect() function for that. You really don't need
to do anything
> different for Authorware than you do for any PHP/MySQL
application in
> terms
> of connecting to the database.
>
> My PHP script returns data to AW in the form of
name=value pairs delimited
> by the ampersand character. I then use the following
code in AW to convert
> them into lists:
>
> =========================
> -- Use this routine to break queryString into name /
value arrays.
> -- Assumes a database query returns a string of
name=value pairs
> -- delimited by the ampersand (&) character.
>
> -- strip leading & from queryString
> queryString := SubStr(queryString, 1,
CharCount(queryString))
>
> -- break into list of individual lines
> tempList := Replace("&", Return, queryString)
>
> listLength := LineCount(tempList)
>
> -- create empty arrays for name and value
> name := Array("", listLength)
> value := Array("", listLength)
>
> repeat with counter := 1 to listLength
> singleLine := GetLine(tempList, counter)
> name[counter] := GetWord(1, Replace("=", " ",
singleLine))
> value[counter]:= GetWord(2, Replace("=", " ",
singleLine))
> end repeat
>
> -- now you will need to add a separate calc icon with a
routine to
> -- read the data from the arrays. name[counter] matches
value[counter]
> =========================
>
> I follow this with another Calc icon (I could have done
it all in one
> calc)
> that parses the names and assigns the values to my
custom AW variables:
>
> =========================
> -- get just the info we want, and store in variables
>
> repeat with counter := 1 to listLength
> if name[counter] = "Lesson1Complete" then
> Lesson1Complete := Number(value[counter])
> else if name[counter] = "Lesson2Complete" then
> Lesson2Complete := Number(value[counter])
> else if name[counter] = "Lesson3Complete" then
> Lesson3Complete := Number(value[counter])
> else if name[counter] = "Lesson4Complete" then
> Lesson4Complete := Number(value[counter])
> else if name[counter] = "Lesson5Complete" then
> Lesson5Complete := Number(value[counter])
> else if name[counter] = "Lesson6Complete" then
> Lesson6Complete := Number(value[counter])
> else if name[counter] = "Lesson7Complete" then
> Lesson7Complete := Number(value[counter])
> else if name[counter] = "Lesson8Complete" then
> Lesson8Complete := Number(value[counter])
> else if name[counter] = "OverviewComplete" then
> OverviewComplete := Number(value[counter])
> else if name[counter] = "grade" then
> score := Number(value[counter])
> else if name[counter] = "passed" then
> passed := Number(value[counter])
> end if
> end repeat
I'd like to point out here that any time you have a series of
variables that
all have identical names except for a number in the variable
name, you
should be looking at lists. I'm surprised, Paul, that you
have lists used
to the extent that you're able to use Value[counter] on the
right side of
the equation, yet you're not using lists on the left side of
the equation.
Let's look at how this code could be made super simple by
having ONE list
variable, LessonComplete, instead of Lesson1Complete through
Lesson8Complete.
-- Assumes a database query returns a string of name=value
pairs
-- delimited by the ampersand (&) character.
-- strip leading & from queryString
--(note you could also not add this ampersand on the PHP
side)
queryString := SubStr(queryString, 1, CharCount(queryString))
-- break into list of individual lines
tempList := Replace("&", Return, queryString)
listLength := LineCount(tempList)
-- create empty arrays for name and value
name := Array("", listLength)
LessonComplete := []
repeat with counter := 1 to listLength
singleLine := GetLine(tempList, counter)
name[counter] := GetWord(1, Replace("=", " ", singleLine))
LessonComplete[name[counter] * 1] := GetWord(2, Replace("=",
singleLine))
end repeat
-- now you will need to add a separate calc icon with a
routine to
-- read the data from the arrays. name[counter] matches
value[counter]
--No you don't...You're DONE :-)
Also note that this is extensible...you can have Lesson 9,
10, etc. and not
have to change the code. You can also lower the amount of
data being
transmitted, because now instead of Lesson8Complete=1 all you
need is 8=1.
This lowers the server load and speeds the response. It has
advantages on
the Authorware side as well, because if, for instance, you
had a series of
buttons that were checked or not based on the completion, you
could do the
same type of loop. Separate variable names do not allow for
that type of
loop unless you use Eval (ugh).
HTH;
Amy

Similar Messages

  • How to get the data from mysql database which is being accessed by a PHP application and process the data locally in adobe air application and finally commit the changes back in to mysql database through the PHP application.

    How to get the data from mysql database which is being accessed by a PHP application and process the data locally in adobe air application and finally commit the changes back in to mysql database through the PHP application.

    If the data is on a remote server (for example, PHP running on a web server, talking to a MySQL server) then you do this in an AIR application the same way you would do it with any Flex application (or ajax application, if you're building your AIR app in HTML/JS).
    That's a broad answer, but in fact there are lots of ways to communicate between Flex and PHP. The most common and best in most cases is to use AMFPHP (http://amfphp.org/) or the new ZEND AMF support in the Zend Framework.
    This page is a good starting point for learning about Flex and PHP communication:
    http://www.adobe.com/devnet/flex/flex_php.html
    Also, in Flash Builder 4 they've added a lot of remote-data-connection functionality, including a lot that's designed for PHP. Take a look at the Flash Builder 4 public beta for more on that: http://labs.adobe.com/technologies/flashbuilder4/

  • How to read a data from USB port using JAVA

    hi all,
    i need to know how to read a data from USB port using java. any API are available for java ?.........please give your valuable ideas !!!!!!!!!
    Advance Thanks!!

    You can do this. Please use this link
    [http://www.google.co.in/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=uHu&q=java+read+data+from+usb+port&btnG=Search&meta=&aq=f&oq=]
    What research did you do of your own? Have you done some testing application and tried yourself??

  • How to read the data from Excel file and Store in XML file using java

    Hi All,
    I got a problem with Excel file.
    My problem is how to read the data from Excel file and Store in XML file using java excel api.
    For getting the data from Excel file what are all the steps i need to follow to get the correct result.
    Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
    Thanks & Regards,
    Sreenu,
    [email protected],
    india,

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • How to read the data from excel file and store into the table?

    Hi All,
    I have table with BLOB datatype contains a excel file. I have to read that data from excel and store into one table with all the fields in excel.
    All the excel fields and my table columns are same.
    Can you share with me how can acheive this using LOB's?
    Thanks

    Hi OraSuirya,
    you can try with external tables .
    syntax as follows
    create table ext_table_csv (
    i Number,
    n Varchar2(20),
    m Varchar2(20)
    organization external (
    type oracle_loader
    default directory ext_dir
    access parameters (
    records delimited by newline
    fields terminated by ','
    missing field values are null
    location ('file.csv')
    reject limit unlimited;
    For this you need to create directory
    Directory Creation syntax:
    create or replace directory ext_dir as 'D:\oracle\user_dir\ext_dir';
    grant read, write on directory ext_dir to <User>;
    please paste the excel file in the particular directory .
    I hope this will help you.
    Please correct me if I am wrong anywhere .
    Thanks,
    Tippu.

  • How to read the data from a file in another computer with user name and password login

    How to read read the data from a file in anohter computer which need to login with user name and password?

    duplicate post:  http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2061478
    duplicate post:  http://forums.ni.com/t5/LabVIEW/do-need-to-enter-the-user-name-and-password-when-TCP-ip/m-p/2061612
    duplicate post   http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2060682

  • How to read the data from an excel file into MYSQL by java language

    Hi all,
    I have some data in excel spread sheet and I want to put the data into MYSQL data base. I created the tables in MYSQL> How can I write a program in JAVA that puts the value from excel sheet to mysql??
    I would appreciate your help
    regards

    By typing code at the keyboard... but presumably you meant to ask what code you should type.
    To get data out of Excel there are a few alternatives. The Google keywords I would use to find them are "java excel". I use Apache POI but there are other possibilities, I believe. As for getting the data into MySQL once you have extracted it from Excel, you would use JDBC. But you already knew that, didn't you? You did find the JDBC forum.
    In general it's better to ask a specific question on a forum. If you don't have a clue (which is the way we all start out) then just telling people that isn't going to be helpful. The best you're going to get is links to tutorials, which you could perfectly well have found for yourself by simple web searches.

  • How can i display data from mysql (cant do it using netbeans)

    im confused with changing ResultSet-->List->Array;
    i already done displaying a data table from mysql but im lost on how to display mysql rows to ComboBoxes and JLists...
    im new here.
    how does the setModel() work?
    i hate this GUI stuff.. = (
    thanks...

    im new here.
    how does the setModel() work?
    i hate this GUI stuff.. = (You claim you have JDBC working already, if I understand your post correctly. So you're asking a question about GUIs in the JDBC forum. Not a good strategy. Try the Swing forum.

  • How to read the data from an internal table,when column names are known

    Hi All
    I have a specific requirement. I got an internal table with many fields (let it be my_tab).  Some of the fieldnames (column names in internal table my_tab) are stored in separate internal table(let it be my_fields).
    I need to store/read data corresponding to the fields (whose name is stored in my_fields) from my_tab.
    I am able to build dynamic table (referred by field-symbol) with respect to the given field names in my_fields.
    But i am unable to read the data corresponding to the fieldnames from my_tab.
    Please provide  me some pointer in this regard.
    Regards
    Swetabh Shukla

    HI All
    Thanks for the prompt response. I got solution for my question. Please check below thread. For quick reponse i posted my question in one more category. Thanks to all of you.
    How to read internal table w.r.t. fieldnames stored in other table

  • How to read the data from a column that is in clob data type (but XMLdata)

    Hi ,
    I have a table XYZ which has a column RESPONSE_XML in clob datatype format.we can convert it to XMLTYPE(RESPONSE_XML) to read the data in XML format.
    Now this is the DynamicXML schema file. Here I want to see all the COMMONNAME, ResourceDescribedby_VALUE into column_A, ResourceDescribedby_ResourceSpecCharacteristic_Name tags into column_B
    How can I do that .. any suggestions please ..
    Here is a sample XML:
    <?xml version="1.0" encoding="WINDOWS-1252" ?>
    _- <soap:Body>
    - <SearchResourceResponse xmlns="http://www.google.com/google.xsd">
    - <MessageElements xmlns:tns="http://www.www.google.com/google.xsd" xmlns="">
    <MessageStatus>SUCCESS</MessageStatus>
    - <MessageAddressing>
    <from>gmail</from>
    <to>Gmail SOAPTester</to>
    <messageId>1234</messageId>
    <action>SearchResource</action>
    <transactionId>OR</transactionId>
    <ServiceName>SearchResource</ServiceName>
    <ServiceVersion>1.1</ServiceVersion>
    </MessageAddressing>
    </MessageElements>
    -<SearchResponseDetails xmlns:tns="http://www.www.google.com/google.xsd" xmlns="">
    - <SubNetwork>
    - <Pipe xsi:type="icl:Trail" xmlns:icl="http://www.www.google.com/google.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <CommonName>318-223-4675</CommonName>
    <objectID>91535716980514105329</objectID>
    <SourceSystem>MARS</SourceSystem>
    - *<ResourceDescribedBy> <value>RDSSLA</value>* *<ResourceSpecCharacteristic> <name>*CentralOfficeCode</name>   </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceRelationship>
    - <Resource xsi:type="icl:Trail">
    - <ResourceDescribedBy> <value>001</value> - <ResourceSpecCharacteristic> <name>AssignLocationExternalFormat</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceDescribedBy> <value>001</value> - <ResourceSpecCharacteristic> <name>PairVerticalExternalFormat</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceDescribedBy> <value>001</value> - <ResourceSpecCharacteristic> <name>PairVerticalInternalFormat</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceDescribedBy> <value>+</value> - <ResourceSpecCharacteristic> <name>PairVerticalSign</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceDescribedBy> <value>RDSSLA</value> - <ResourceSpecCharacteristic> <name>CentralOfficeCode</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceDescribedBy> <value>B</value>- <ResourceSpecCharacteristic> <name>EntityType</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceType>FeederCircuit</ResourceType>
    - <LogicalPhysicalResource>
    - <PhysicalResource xsi:type="icl:PhysicalConnector">
    <usageState>S</usageState>
    - <ResourceDescribedBy> <value>25.392</value> - <ResourceSpecCharacteristic> <name>CableLength</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    </PhysicalResource>
    </LogicalPhysicalResource>
    - <TerminationPoint xsi:type="icl:TrailTerminationPoint">
    <CommonName>1000/34A</CommonName>
    - </Resource>
    </ResourceRelationship>
    <lrStatus>W</lrStatus>
    </Pipe>
    </SubNetwork>
    </SearchResponseDetails>

    you don't appear to have posted valid XML, so I can't reproduce using your example, but you will need to look at something like this:
    select xtab.common_name
      from your_table yt
          ,xmltable('/SearchResourceResponse'
              passing xmltype(yt.response_xml)
              columns
                  common_name varchar2(20) path 'SearchResponseDetails/CommonName'
          ) xtab
    ;

  • How to read the data from a sorted table

    Hi all,
    How to read data from the sorted tables. Please provide some examples.
    Thanks and regards,
    Lisa

    You can read like this :
    DATA: BEGIN OF LINE,
    COL1 TYPE I,
    COL2 TYPE I,
    END OF LINE.
    DATA ITAB LIKE SORTED TABLE OF LINE WITH UNIQUE KEY COL1.
    DO 4 TIMES.
      LINE-COL1 = SY-INDEX.
      LINE-COL2 = SY-INDEX ** 2.
    INSERT LINE INTO TABLE ITAB.
    ENDDO.
    CLEAR LINE.
    READ TABLE ITAB WITH TABLE KEY COL1 = 3
                    INTO LINE TRANSPORTING COL2.
    WRITE:   'SY-SUBRC =', SY-SUBRC,
           / 'SY-TABIX =', SY-TABIX.
    SKIP.
    WRITE: / LINE-COL1, LINE-COL2.

  • How to read the data from XML file and insert into oracle DB

    Hi All,
    I have below require ment.
    I will receive data in the XML file. then i need to read that data and insert into oracle tables. please let me know how this can be handled.
    Many Thanks.

    Sounds a lot like this question, only with less details.
    how to read data from XML  variable and insert into table variable
    We can only help if you provide us details to help as we cannot see what you are doing and only know what you tell us.  Plenty of examples abound on the forums that cover the topics you seek as well.

  • How to read Image data from oracle DB?

    How to read a oracle database object ORDSYS.ORDImage from oracle
    database?
    I can get a oracle.sql.STRUCT object from the database, but i can not
    find the way to convert data to a image object(like oracle.ord.im.OrdImage)
    I had used "OrdImage imgObjj1 =
    (OrdImage)rs.getCustomDatum(1, OrdImage.getFactory());"
    it's a example from oralce.
    But OracleResultSet.getCustomDatum() method is already deprecated,
    i can't find a new method to instead of it.
    Who can help me ? Thank you!
    [email protected]

    More than likely, this is the interface you will use:
    java.sql.Blob
    http://java.sun.com/j2se/1.4/docs/api/java/sql/Blob.html
    Once you get the blob, construct a Raster objects from the Bytes you receive from the blob. Then you can create an Image, ImageIcon, BufferedImage, whatever with the Raster object.
    Good luck!

  • How to Read specific data from file and do a calculation and display on the output

    FYI: Below is the function use for the writing:
    -OpenFile(use ASCII)
    -sprintf
    -WriteFile
    Example: Output from the doc file
    …EndTime: 09:34:48 program time: 0.567663 sec
    …EndTime: 09:36:48 program time: 0.666666 sec
    My objective is to read data 0.666666 (FYI: is last sentence of the file) to do some calculation. How can we read specific data(specific location) from file..
    Any advice or help?
    What is the function needed?

    I would consider counting line feeds and checking for end-of file to isolate the last line, which then can be read using fscanf...
    Have a look at getc...
    character = fgetc ( stream );
    if ( character == '\n' ) // new line
    if ( character == EOF ) // end-of-file

  • How to read updated data from a real-time generated file?

    I have a question:
    I want to read the 10 mostly updated data from a real time generated data file. The data in this file is accumulated. how can i read mostly recently data to an applet? and further to using this data to draw a real-time graph? pls help
    kelvin t.l. tse

    Hi,
    I think there is no "typical" way. You will have to define a convention on how the new data are stored into the file, so as to know how to accessthem. If new data are simply put at theend of your file, you may use a RandomAccessFile to read only those lines that interest you (the 1 final lines).Otherwise, you should at least know how the data file is written.
    You can know if thedata file has been modified with the File.lastModified() method. This retrurns a long value corresponding to the date and hour the file was last modified. Store that value ito you appl. and perdiodically (use a Thread), compare that value with the value returned by lastModief(). If both value are NOt equal, then the file has been updated
    it's all a question of knowing how the data are stored into the datafie generated.
    Be also aware that you will probably have problem when your java appl. tries to read the file at the same time it is updated by the other application. I guess when theother application writes data into the file, you will not be able to read it. So, use try{} catch statements and first check to see if you can read the file with File. canRead(). If not, simply delay the reading process by asking a Thread.yield() or Thread.delay (1000)...
    vincent

Maybe you are looking for

  • How to call a perl module from Java program.

    Hi, I create a simple java program as follows class test{ public static void main(String args[]) {try {                     Runtime r = Runtime.getRuntime(); r.exec("perl test.pl"); catch(Exception e) {e.printStackTrace();} and test.pl is located in

  • Down Payment - Comittment

    HI All, I have a issue with the budget.  When ever i have gone thorugh for debugg the issue, i came to know there was a down payment exist for the PO.  Is it down payment effect the committment?  I have gone through the sdn search also.  i got input

  • Where is the iTunes to/from iPhone pairing information stored

    When you sync an iPhone with iTunes it (the iPhone) has a continuted/ongoing relationship with that instance of iTunes.  For instance if you try to sync the same IP with another iTunes installation you get prompted to that effect. What I want to know

  • Safari not loading smoothly and images not loading at all on some sites

    Hi, for the past few days Safari has started to load very slowly and on certain sites Amazon & Mark & Spencers for example it takes ages to load and then once loaded no images are displayed. Blue ? mark... I have searched through the pages and tried

  • Customer specific stock

    Dear Gurus, If I am  manufacturing against S/Ord, I ship a partial qty to the customer and the remaining qty is not needed anymore by that customer, how do I make this remaining material available as open stock and assign it to another sales order or