Jump to content

viviosoft

Members
  • Posts

    85
  • Joined

  • Last visited

Posts posted by viviosoft

  1. Hello guys!

     

    My problem seems simple but not.  I've been struggling with this problem for some time now.  I've passed the first part (I think) of getting data from my remote server.  However, the error I'm getting is parsererror when getting the data back in the ajax call?

     

    The jQuery (1.7.1) source code make the request:

     

            $.ajax({
                type: "GET",
                url: 'http://www.domain.com/projects/vs/mobile/services/android-stores-list.php',
                contentType: "application/json",
                dataType: "jsonp",
                crossDomain: true,
                beforeSend: function(xhr) {
                    alert('before send test');
                },
                error: function(jqXHR, textStatus, errorThrown) {
                    alert('Sorry. Error during parsing Sport Data JSON!-> ' + textStatus);
                },
                success: function(data, status) {
                    console.log(status + ' jSON load!' + data);
                },
                complete: function(obj, textStatus) {
                    alert('complete: ' + textStatus);
                }
            });
    
    

     

    Here's the php file that gets the data android-stores-list.php: (I realize that I'm posting this in Ajax help, wasn't sure the best place to get help?)

     

    header('Cache-Control: no-cache, must-revalidate');
    header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
    header('content-type: application/json; charset=utf-8');
    
    try {
    
        $dbh = new PDO("mysql:host=localhost;dbname=$db_name", $db_user, $db_pass);
        $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $stmt = $dbh->prepare($sql);
        //	$stmt->bindParam("id", $_GET[id]);
        $stmt->execute();
        $stores = $stmt->fetchAll(PDO::FETCH_OBJ);
        $dbh = null;
        echo '{"items":' . json_encode($stores) . '}';
    
    } catch (PDOException $e) {
        echo '{"error":{"text":' . $e->getMessage() . '}}';
    }
    
    

     

    The json response looks like the following:

     

    {"items":[{"id":"29","cId":"3","sName":"Milford Plaza Hotel","sNumber":"3061","sCustNm":"VS7997","sSalesman":"1234","sAddress":"","sContact":"","sPhone":""},{"id":"26","cId":"7","sName":"Circle K Bowling Green","sNumber":"5670","sCustNm":"VS7976","sSalesman":"1234","sAddress":"1091 N Main Street\r\nBowling Green, Ohio 43402","sContact":"","sPhone":""}]}
    

     

     

    Any direction would be greatly welcome!  Thanks for any help you can provide me.

     

  2. Because you have error checking set in your code.  Any PHP errors (like "Undefined variable") will be displayed.  If you were to comment those two lines out, you would most likely not have seen those errors.  It's a nice thing sometimes to be able to debug using the below two lines of code in PHP.  However, sometimes those two lines of code could create error messages that you may not care about.

     

            error_reporting(E_ALL);
    ini_set('display_errors', True);
    

     

    Happy Coding!!

     

  3. Your are most welcome.  In your code.  I notice

     

        $body = "Name: $Name\n\n
        Email: $Email\n\n
        Comments: $Comments"
    

     

    Where are $Name, $Email, and $Comments getting set?  I believe that's where the error is happening.  They this and see what happens.

     

    <?php
    	error_reporting(E_ALL);
    ini_set('display_errors', True);
    
    $path = '/home/***/php';
    set_include_path(get_include_path() . PATH_SEPARATOR . $path);
    
    // Set the email variables from the form here:
    
        $Name = $_POST['Name']; // Pass the Name value to the $Name variable
        $Email = $_POST['Email']; // Pass the Email value to the $Email variable
        $Comment = $_POST['Comment']; // Pass the Comment value to the $Comment variable
    
    require('Mail.php');
    
    $from = "Info <info@**.co.uk>";
    $to = "Info <info@**.co.uk>";
    $subject = "Hi - Test message!";
    
      	$body = "Name: $Name\n\n
                Email: $Email\n\n
                Comments: $Comments";
    
    $host = "mail.**.co.uk";
    $username = "info@**.co.uk";
    $password = "***";
    
    $headers = array('From' => $from,
                      'To' => $to,
                      'Subject' => $subject);
    $smtp = Mail::factory('smtp',
                           array('host' => $host,
                                'auth' => true,
                                'username' => $username,
                                'password' => $password));
    
    $mail = $smtp->send($to, $headers, $body);
    
    if (PEAR::isError($mail)) {
         echo("<p>" . $mail->getMessage() . "</p>");
    } else {
         echo("<p>Message successfully sent!</p>");
    }
    ?>
    
    
    

     

     

     

  4. Wow!  I guess I should have waited to post ;) .  I figured out a solution.  Well, I didn't I found the solution on php.net.  Here's what I found for those that might have the same problem.

     

    <?php
    var_dump(remove_duplicate($farmData, 'farmName'));
    
    function remove_duplicate($array, $field)
    {
        foreach ($array as $sub)
           $cmp[] = $sub[$field];
        $unique = array_unique($cmp);
       
    foreach ($unique as $k => $rien)
            $new[] = $array[$k];
        return $new;
    }
    ?>
    

  5. It would be nice if I could retain the key names in the initial array.  Here's the output now.  The method I'm using "works" but I loose the other keys in the array.

     

    <?php
    $dup_name = array();
    
    foreach ($farmData as $farm) {
        $single_name = array_merge($dup_name, explode(",", $farm['farmName']));
    }
    
    var_dump(array_unique($single_name));
    ?>
    

     

    Output:

     

    <?php
    array
      0 => string 'Hallinan' (length=
      1 => string 'Holt' (length=4)
      6 => string 'Home' (length=4)
      9 => string 'Kenyon' (length=6)
      19 => string 'Lane' (length=4)
      21 => string 'Leach' (length=5)
      23 => string 'Robinson' (length=
      24 => string 'Shorey' (length=6)
      26 => string 'Stream' (length=6)
    ?>
    

  6. I think this will do what I'm after.  If there's a cleaner way or another approach, by all means please...

     

    
    $dup_name = array();
    
    foreach ($farmData as $farm) {
        $single_name = array_merge($dup_name, explode(",", $farm['farmName']));
    }
    
    var_dump(array_unique($single_name));
    
    

  7. On your select statement using the following to see any errors you might be getting:

     

    
    $sql = 'SELECT * FROM `'.$tbl_name.'`';
    $result = mysql_query($sql) or die(mysql_error()); // <-- Adding  or die(mysql_error()); will help you determine if you have any errors in your query
    
    

     

    You need to start you php echos with <?php NOT <? .  Thy this and see if you get any results in your table.

     

     

    
                        <?php while ($rows = mysql_fetch_array($result)): ?>
                        <tr>
                            <td align="center" bgcolor="#FFFFFF"><input name="need_delete[<?php echo $rows['msgid']; ?>]"
                                                                        type="checkbox"
                                                                        id="checkbox[<?php echo $rows['msgid']; ?>]"
                                                                        value="<?php echo $rows['msgid']; ?>"></td>
                            <td bgcolor="#FFFFFF"><?php echo $rows['Id']; ?></td>
                            <td bgcolor="#FFFFFF"><?php echo htmlspecialchars($rows['Username']); ?></td>
                            <td bgcolor="#FFFFFF"><?php echo htmlspecialchars($rows['Message']); ?></td>
                            <td bgcolor="#FFFFFF"><?php echo htmlspecialchars($rows['Subject']); ?></td>
                        </tr>
                        <?php endwhile; ?>
    
    

     

     

     

  8. I believe your error message is coming from the Mail class you are using.  There's a lot more code in your second code example.  I would start small and ONLY use what the Mail class requires to send the email.  Take out the validation and the like and start there.  Strip it down.  Start by passing the values without the Mailer functions.  For example:  Echo the form values after you have submitted the form and see of you are getting those passed okay.  Then move to your Mail operation.  Once you get that working then move to your validation and the like.

     

    Comment out ALL your code in form-mailer2.php and add the following.  If you don't see any data at all then you have a problem with calling your form-mailer2.php file.

     

    
    <?php
    
    echo 'Your posted values are: ';
    echo $_POST['Name'];
    echo $_POST['email'];
    echo $_POST['comment'];
    
    ?>
    
    

  9. You could try passing the values using jQuery (AJAX).  That way the data isn't being seen by the end-user in the address bar.

     

    http://api.jquery.com/jQuery.ajax/

     

    The some.php would handle your database inserting.  You would "get" the score and game values from hidden fields on the form.  Hope this helps.  This is not the place to discuss jQuery or Ajax so I can't go into great detail.  There's quite a bit of information out there about how to pass data using jQuery and Ajax.  I've sure this will get you started in the right direction.

     

    $.ajax({

      type: "POST",

      url: "some.php",

      data: "score=100&game=4"

    }).done(function( msg ) {

      alert( "Data Saved: " + msg );

    });

     

     

     

  10. Hello All -

     

    I have the following array:

     

    array
      0 => 
        array
          'farmName' => string 'Hallinan' (length=
          'farmInsNum' => string '' (length=0)
          'farmFSA' => string '' (length=0)
      1 => 
        array
          'farmName' => string 'Holt' (length=4)
          'farmInsNum' => string '' (length=0)
          'farmFSA' => string '' (length=0)
      2 => 
        array
          'farmName' => string 'Holt' (length=4)
          'farmInsNum' => string '' (length=0)
          'farmFSA' => string '' (length=0)
      3 => 
        array
          'farmName' => string 'Holt' (length=4)
          'farmInsNum' => string '' (length=0)
          'farmFSA' => string '' (length=0)
      4 => 
        array
          'farmName' => string 'Holt' (length=4)
          'farmInsNum' => string '' (length=0)
          'farmFSA' => string '' (length=0)
      5 => 
        array
          'farmName' => string 'Holt' (length=4)
          'farmInsNum' => string '' (length=0)
          'farmFSA' => string '' (length=0)
      6 => 
        array
          'farmName' => string 'Home' (length=4)
          'farmInsNum' => string '' (length=0)
          'farmFSA' => string '' (length=0)
      7 => 
        array
          'farmName' => string 'Home' (length=4)
          'farmInsNum' => string '' (length=0)
          'farmFSA' => string '' (length=0)
      8 
        array
          'farmName' => string 'Home' (length=4)
          'farmInsNum' => string '' (length=0)
          'farmFSA' => string '' (length=0)

     

    The data comes from a flat file that has (as you can see) many of the same names like Home and Holt.  Is there a way to extract the first Holt and Home from the array and put those values in a new array?  So my new array would look something like:

     

    array
      0 => 
        array
          'farmName' => string 'Hallinan' (length=
          'farmInsNum' => string '' (length=0)
          'farmFSA' => string '' (length=0)
      1 => 
        array
          'farmName' => string 'Holt' (length=4)
          'farmInsNum' => string '' (length=0)
          'farmFSA' => string '' (length=0)
      2 => 
        array
          'farmName' => string 'Home' (length=4)
          'farmInsNum' => string '' (length=0)
          'farmFSA' => string '' (length=0)
    

     

    I look through php.net and really couldn't find a function that could handle what I was after.  I'm sure I'd have to use a combination of each() and reset() or maybe not?  Any help would be very welcome.  Thanks!

     

  11. Haha, really Muddy_Funster!  This is how you respond?  Why even leave a reply?  What I take from your response is that you don't know how to answer the question or you don't know what I want to accomplish or (the real reason I think) you don't know how to do what I want.  You should stay off this forum and let the REAL professionals reply.

  12. Hello all -

     

    Currently I have functions that will parse a csv file and insert the values into a database.  That code is working.  However, I want to take it a step further and ONLY insert selected fields from the csv file.  For example, I have 14 rows in the csv and of those I only want to import values into the database of the rows that I define. 

     

    So, gName, fName and id -> take those and pump those values into the database.  I'm sure this a possible but not sure of the direction I should take.  Any help on my problem would be excellent!

     

    Here's the code:

     

    csv_file_to_mysql_table('tim 3.csv', 'growers');
    
    function csv_file_to_mysql_table($source_file, $target_table, $max_line_length = 10000)
    {
        if (($handle = fopen("$source_file", "r")) !== FALSE) {
            $columns = fgetcsv($handle, $max_line_length, ",");
            foreach ($columns as &$column) {
                $column = str_replace(".", "", $column);
            }
    
            $insert_query_prefix = "INSERT INTO $target_table (" . join(",", $columns) . ")\nVALUES";
            while (($data = fgetcsv($handle, $max_line_length, ",")) !== FALSE) {
    
                while (count($data) < count($columns))
    
                    array_push($data, NULL);
    
                $query = "$insert_query_prefix (" . join(",", quote_all_array($data)) . ");";
                mysql_query($query) or die(mysql_error());
    
            }
    
            fclose($handle);
        }
    }
    
    function quote_all_array($values)
    {
        foreach ($values as $key => $value)
            if (is_array($value))
                $values[$key] = quote_all_array($value);
            else
                $values[$key] = quote_all($value);
        return $values;
    }
    
    function quote_all($value)
    {
        if (is_null($value))
            return "NULL";
    
        $value = "'" . mysql_real_escape_string($value) . "'";
        return $value;
    }
    

     

     

    Here's some sample data:

     

    Long,Lat,id,gName,fId,fName,fldId,fldName,fldAcers,featureID,objID,fInsu,fFSA,fBid
    -82.38306422,40.38439870,2,Norris| Tim,3,Hallinan,4,H1 - 10.0,9.900,1,1, , ,29
    -82.22279060,40.42760230,2,Norris| Tim,4,Holt,5,Ho1,11.50,1,1, , ,30
    -82.21917211,40.42838107,2,Norris| Tim,4,Holt,6,Ho2,15.10,1,1, , ,31
    -82.21710436,40.42454375,2,Norris| Tim,4,Holt,7,Ho3,17.90,1,1, , ,32
    -82.21833571,40.42367314,2,Norris| Tim,4,Holt,7,Ho3,17.90,2,2, , ,32
    -82.21595345,40.42200315,2,Norris| Tim,4,Holt,9,Ho4,9.100,1,1, , ,34
    -82.36538195,40.37711617,2,Norris| Tim,5,Home,10,H1 - 36.3A,36.20,1,1, , ,35
    -82.36159625,40.37804250,2,Norris| Tim,5,Home,11,H2 - 3.9A,3.900,1,1, , ,36
    -82.36196265,40.38085335,2,Norris| Tim,5,Home,12,H3 - 6A,7.000,1,1, , ,37
    -82.41030962,40.38997625,2,Norris| Tim,2,Kenyon,13,K10-17A,17.00,1,1, , ,38
    -82.38584288,40.35998635,2,Norris| Tim,2,Kenyon,14,K11-14A,14.52,1,1, , ,39
    -82.41644710,40.37927258,2,Norris| Tim,2,Kenyon,15,K3 - 18.2A,18.20,1,1, , ,40
    -82.40744700,40.37788250,2,Norris| Tim,2,Kenyon,16,K4 - 26.2A,26.12,1,1, , ,41
    -82.40390048,40.37467350,2,Norris| Tim,2,Kenyon,17,K5 - 8.9A,8.874,1,1, , ,42
    -82.38605720,40.36920760,2,Norris| Tim,2,Kenyon,18,K6 - 19.3A,18.22,1,1, , ,43
    -82.39960597,40.38844915,2,Norris| Tim,2,Kenyon,19,K7 - 18.4A,18.37,1,1, , ,44
    -82.39515150,40.39498212,2,Norris| Tim,2,Kenyon,20,K8 - 7.3A,7.324,1,1, , ,45
    -82.38817795,40.39458225,2,Norris| Tim,2,Kenyon,21,K9 - 40.4A,40.28,1,1, , ,46
    -82.38836722,40.39172487,2,Norris| Tim,2,Kenyon,21,K9 - 40.4A,40.28,2,2, , ,46
    -82.40294059,40.35565598,2,Norris| Tim,10,Lane,2,1,6.900,1,1, , ,47
    -82.40579843,40.35399913,2,Norris| Tim,10,Lane,22,2,7.200,1,1, , ,48
    -82.38322795,40.37619695,2,Norris| Tim,6,Leach,23,L1 - 1.5,1.500,1,1, , ,49
    -82.38334655,40.38060737,2,Norris| Tim,6,Leach,24,L2 - 17.6,17.60,1,1, , ,50
    -82.38032235,40.38354262,2,Norris| Tim,7,Robinson,25,R1 - 7.5,7.400,1,1, , ,51
    -82.39919331,40.35353322,2,Norris| Tim,9,Shorey,26,SH1,5.757,1,1, , ,52
    -82.40033216,40.35715336,2,Norris| Tim,9,Shorey,28,SH2,13.39,1,1, , ,54
    -82.37072642,40.31789197,2,Norris| Tim,8,Stream,27,S1,17.80,1,1, , ,53

  13. Hello all,

     

    I've been working on parsing through some XML data that is formatted as x-schema.  It's been a challenge to say the least.  I've looked at XMLReader and the like to see if I can parse through the data but with no luck.  I found an approach that works but having trouble iterating over the nodes inside the nodes.  I'll try to explain:

     

    Here's what I have so far.  The code produces the following result set:

     

        [4] => Array
            (
                [FARM:NAME] => Array
                    (
                        [FARM:NAME] => Kenyon Farm
                        [FARM:FARM] => 
    
                        [FARM:TOTALAREA] => 999
                        [FARM:BUSINESSFIELDS] => 
                        [bUSINESSFIELD:FIELD] => 
                        [bUSINESSFIELD:LABEL] => K9
                        [bUSINESSFIELD:TOTALROTATIONS] => 1
                        [bUSINESSFIELD:TOTALAREA] => 998
                        [bUSINESSFIELD:FIELDOPTIONS] => 
    
                        [bUSINESSFIELD:FIELD_BOUNDARY] => 
                        [bUSINESSFIELD:DATAFILE] => FieldBoundary_2682
                        [bUSINESSFIELD:ACTIVITIES] => 
    
                        [CUST:FARMS] => 
    
                    )
    
            )
    

     

    Here's the code that produces that array:

     

        $tuData=file_get_contents("xml/tim.xml");
        $simple = $tuData;
    
        $p = xml_parser_create();
        xml_parse_into_struct($p, $simple, $vals, $index);
        xml_parser_free($p);
    
        $getValue="";
        $counter=0;
    
        print"<pre>";
        print_r($vals);
    
        foreach($vals as $data)
        {
            if(isset($data['tag']))
            {
                if($data['tag'] == 'FARM:NAME') {
    
                    $key = $data['tag'];
                    $counter++;
    
                }
    
                if(trim($key)!== '' && trim($data['tag']) !== '') {
    
                    $arData[$counter][$key][$data['tag']] = $data['value'];
    
                }
            }
        }
    
        print"<pre>";
        print_r($arData);
    

     

    Now to my problem.  You'll notice that the array has a key called [bUSINESSFIELD:LABEL] ... in the attached xml file there can be more than one field for each farm.  My current solution only gets the first field in the xml file (as the current example shows above) and moves to the next farm and creates a new array of data. 

     

    I would like to get the other fields for each farm and "stuff" them in the same array.  Array's are not my strong suite and would be grateful to anyone that could help me with this problem.

     

    Thanks a bunch!

     

    17601_.txt

  14. Hello -

     

    I have the following plugin.  It's working but I can't figure out how to return an object from the ajax method below.

     

    Here's the function that calls the plugin:

     

    
            $('#list_results tr').live('click', function() {
    
                var itemRow = $(this).closest('#list_results tr');
    
                   // Use plugin selectItem and pass options 
    
                    $().selectItem({
                        dataFile: 'post-data/inv-get-item.php',
                        iValue: itemRow[0].id
                    });
    
                alert(itemDataObj[0].id);  // trying to return obj from ajax on success of post??
    
                //  $('#vId').val(itemData[0].id);
                //  $('#itemCode').val(itemData[0].itemCode);
                //  $('#itemDesc').val(itemData[0].itemDesc);
                //  $('#itemWholesale').val(itemData[0].itemWholesale);
           
            });
    
    

     

    Here's the plugin:  I want to return itemDataObj object to use within the above function.  I'm sure this can be done just not sure how. 

     

    Any help would be great!  Thanks

     

    
    (function($) {
    
        $.fn.selectItem = function(options){
    
            var defaults = {
                dataFile: null,
                iValue: null,
                resultsSelector: null
            },
    
            settings = $.extend({}, defaults, options);
    
            $.ajax({
              type: "POST",
              url: settings.dataFile,
              data: ({ itemID : settings.iValue }),
              dataType: "json",
              success: function(itemDataObj) {
    
                  return itemDataObj[0];
    
              }
            })
    
        }
    
    }) (jQuery);
    

  15. Thank you salathe!  That worked.  Man I can't believe that the jQuery Library Documentation didn't even have anything on this.  Even in their examples it doesn't state to have the dataType defined??  Anyway, thanks for the help and quick response!

     

    As for defining the meta Content-Type... would I just add another meta tag in the header?  I guess I'm not sure where I should be adding the meta tag or how to go about adding it.  That seems trivial right? haha!

     

     

  16. Hello all,

     

    I have the following code that I thought I could retrieve json_encoded data but I'm just getting "undefined".  Thanks for any help you can provide.

     

    The json_encoded string from the php array:

     

    [{"table":null,"id":"2","itemCode":"1003","itemDesc":"Item infor for 1003","itemWholesale":"1.99"}]

     

    I thought I could "grab" the name of each in the array and output the data accordingly.  So on success of the ajax post (which does return data) I tried alert(itemData.itemCode);  This is on line 10 in the below code snippet.  Using this method returns "undefined" and NOT the data 1003 as I would expect.

     

    I even tried the jquery's .get() method and that also returned null??

     

    
            $('#search_results tr').live('click', function() {
                var $itemrow = $(this).closest('tr');
                var itemId = $itemrow[0].id;
                $.ajax({
                  type: "POST",
                  url: "post-data/inv-get-item.php",
                  data: "itemID="+itemId,
                  success: function(itemData) {
                       alert(itemData[0].itemCode);
                  }
                });
            })
        
    

     

     

  17. Hello btherl,

     

    This is what I ended up with.  It works great and is exactly what I was after.  However, I was just wondering if this is the same algorithm you had in mind?  Or if you can think of a "better" or more efficient way of handling this?  Man, I can't thank you enough for the help you provided!!

     

    <?php
    
        if ($ediLine[0] == 'SLN') {
            # New item.  Check if we need to store the old one
            if ($cur_item !== null) {
                $items[] = array( 'dateUpdated' => $date, 'styleNum' => $styleNum, 'mfgr' => $mfgr, 'sku' => $sku, 'color' => $color, 'rollPrice' => $price1, 'cutPrice' => $price2, 'length' => $length, 'width' => $width, 'pattern' => $pattern );
            }
            $cur_item['SLN'] = $ediLine[10];
            $sku = $cur_item['SLN']; # Capture SKU number.
    
        } elseif ($ediLine[0] == 'DTM') {
             $date = $ediLine[2]; # Capture Color
        } elseif ($ediLine[0] == 'LIN') {
            $mfgr = $ediLine[15]; # Capture Manufacture
            $styleNum = $ediLine[7]; # Capture Style Number - This will be used to ID each product for updating (Ref)
        } elseif ($ediLine[2] == '73') {
            $color = $ediLine[5]; # Capture Color
        } elseif ($ediLine[9] == 'ST') {
           $price1 = $ediLine[3]; # Capture the first price for each SKU
        } elseif ($ediLine[9] == 'CT') {
            $price2 = $ediLine[3]; # Capture the second price for each SKU
        } elseif ($ediLine[2] == 'LN') {
            $length = $ediLine[3] . $ediLine[4]; # Capture Length
        } elseif ($ediLine[2] == 'WD') {
            $width = $ediLine[3] . ' ' . $ediLine[4]; # Capture Width
        } elseif ($ediLine[2] == 'NU') {
            $pattern = $ediLine[3] . ' ' . $ediLine[4]; # Capture Pattern
        }
    
    } // End foreach loop
    
    ?>
    

     

    Here's what the output looks like:

     

    array
      0 => 
        array
          'dateUpdated' => string '20110417' (length=
          'styleNum' => string 'A3197' (length=5)
          'mfgr' => string 'TIMBERLANE' (length=10)
          'sku' => string 'A319797100' (length=10)
          'color' => string 'ALPACA' (length=6)
          'rollPrice' => string '10.89' (length=5)
          'cutPrice' => string '12.42' (length=5)
          'length' => string '150.00FT' (length=
          'width' => string '12.00 FT' (length=
          'pattern' => string '36"W X 36"L SM IN' (length=17)
      1 => 
        array
          'dateUpdated' => string '20110417' (length=
          'styleNum' => string 'A3197' (length=5)
          'mfgr' => string 'TIMBERLANE' (length=10)
          'sku' => string 'A319797101' (length=10)
          'color' => string 'FLAX' (length=4)
          'rollPrice' => string '10.89' (length=5)
          'cutPrice' => string '12.42' (length=5)
          'length' => string '150.00FT' (length=
          'width' => string '12.00 FT' (length=
          'pattern' => string '36"W X 36"L SM IN' (length=17)
      2 => 
        array
          'dateUpdated' => string '20110417' (length=
          'styleNum' => string 'A3197' (length=5)
          'mfgr' => string 'TIMBERLANE' (length=10)
          'sku' => string 'A319797102' (length=10)
          'color' => string 'CAFE NOIR' (length=9)
          'rollPrice' => string '10.89' (length=5)
          'cutPrice' => string '12.42' (length=5)
          'length' => string '150.00FT' (length=
          'width' => string '12.00 FT' (length=
          'pattern' => string '36"W X 36"L SM IN' (length=17)
      3 => 
        array
          'dateUpdated' => string '20110417' (length=
          'styleNum' => string 'A3197' (length=5)
          'mfgr' => string 'TIMBERLANE' (length=10)
          'sku' => string 'A319797103' (length=10)
          'color' => string 'MINK' (length=4)
          'rollPrice' => string '10.89' (length=5)
          'cutPrice' => string '12.42' (length=5)
          'length' => string '150.00FT' (length=
          'width' => string '12.00 FT' (length=
          'pattern' => string '36"W X 36"L SM IN' (length=17)
    

  18. First, thanks again for helping with this.

    Based on that dump, the SLN code should be fetching index 10, not index 3 as I had it.

    Yeah, I saw what you were doing here ;)

     

    Do you have multiple SLN inside a single DTM?

    They sure are.  So would the code change completely?

     

    For prices, I'm guessing those are the CTP lines?  Can you distinguish which is price1 and which is price2 by using the final element, which is either ST or CT?

     

    You are absolutely correct!  I would distinguish price1 and price2 using ST and CT.  It think we are on to something here... man, I'm so glad you are understanding what I'm after here!  Thanks again!

     

  19. Thanks again btherl.  When I do a var_dump on $Items I get the following.  I'm running the dump outside the foreach loop.  Wounder why it's duplicating and not producing new values each new array? 

     

    array
      0 => 
        array
          'DTM' => string '20110413' (length=
          'SLN' => string 'O' (length=1)
      1 => 
        array
          'DTM' => string '20110413' (length=
          'SLN' => string 'O' (length=1)
      2 => 
        array
          'DTM' => string '20110413' (length=
          'SLN' => string 'O' (length=1)
      3 => 
        array
          'DTM' => string '20110413' (length=
          'SLN' => string 'O' (length=1)
      4 => 
        array
          'DTM' => string '20110413' (length=
          'SLN' => string 'O' (length=1)
      5 => 
        array
          'DTM' => string '20110413' (length=
          'SLN' => string 'O' (length=1)
      6 => 
        array
          'DTM' => string '20110413' (length=
          'SLN' => string 'O' (length=1)
    

     

    Here's the $ediLine dump again:

     

    array
      0 => string 'DTM' (length=3)
      1 => string '007' (length=3)
      2 => string '20110413' (length=
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string 'TRN' (length=3)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'LAKE TAHOE 12FT' (length=15)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string 'MAC' (length=3)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'CARINDR' (length=7)
    
    array
      0 => string 'MEA' (length=3)
      1 => string '' (length=0)
      2 => string 'LN' (length=2)
      3 => string '125.0' (length=5)
      4 => string 'FT' (length=2)
    
    array
      0 => string 'MEA' (length=3)
      1 => string '' (length=0)
      2 => string 'WD' (length=2)
      3 => string '12.0' (length=4)
      4 => string 'FT' (length=2)
    
    array
      0 => string 'MEA' (length=3)
      1 => string '' (length=0)
      2 => string 'SW' (length=2)
      3 => string '0.333' (length=5)
      4 => string 'FP' (length=2)
    
    array
      0 => string 'CTP' (length=3)
      1 => string '' (length=0)
      2 => string 'LPR' (length=3)
      3 => string '10.990' (length=6)
      4 => string '' (length=0)
      5 => string 'SY' (length=2)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'ST' (length=2)
    
    array
      0 => string 'CTP' (length=3)
      1 => string '' (length=0)
      2 => string 'LPR' (length=3)
      3 => string '10.990' (length=6)
      4 => string '' (length=0)
      5 => string 'SY' (length=2)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'CT' (length=2)
    
    array
      0 => string 'SLN' (length=3)
      1 => string '1' (length=1)
      2 => string '' (length=0)
      3 => string 'O' (length=1)
      4 => string '' (length=0)
      5 => string '' (length=0)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'SK' (length=2)
      10 => string 'RKDAB408001' (length=11)
      11 => string '' (length=0)
      12 => string '' (length=0)
      13 => string '' (length=0)
      14 => string '' (length=0)
      15 => string 'ST' (length=2)
      16 => string 'A08' (length=3)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '73' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'LIGHTHOUSE' (length=10)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '35' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string '001' (length=3)
    
    array
      0 => string 'SLN' (length=3)
      1 => string '2' (length=1)
      2 => string '' (length=0)
      3 => string 'O' (length=1)
      4 => string '' (length=0)
      5 => string '' (length=0)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'SK' (length=2)
      10 => string 'RKDAB408002' (length=11)
      11 => string '' (length=0)
      12 => string '' (length=0)
      13 => string '' (length=0)
      14 => string '' (length=0)
      15 => string 'ST' (length=2)
      16 => string 'A08' (length=3)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '73' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'COOKIE DOUGH' (length=12)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '35' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string '002' (length=3)
    
    array
      0 => string 'SLN' (length=3)
      1 => string '3' (length=1)
      2 => string '' (length=0)
      3 => string 'O' (length=1)
      4 => string '' (length=0)
      5 => string '' (length=0)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'SK' (length=2)
      10 => string 'RKDAB408003' (length=11)
      11 => string '' (length=0)
      12 => string '' (length=0)
      13 => string '' (length=0)
      14 => string '' (length=0)
      15 => string 'ST' (length=2)
      16 => string 'A08' (length=3)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '73' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'WOOD SAGE' (length=9)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '35' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string '003' (length=3)
    
    array
      0 => string 'SLN' (length=3)
      1 => string '4' (length=1)
      2 => string '' (length=0)
      3 => string 'O' (length=1)
      4 => string '' (length=0)
      5 => string '' (length=0)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'SK' (length=2)
      10 => string 'RKDAB408004' (length=11)
      11 => string '' (length=0)
      12 => string '' (length=0)
      13 => string '' (length=0)
      14 => string '' (length=0)
      15 => string 'ST' (length=2)
      16 => string 'A08' (length=3)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '73' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'CAFÉ LATTE' (length=10)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '35' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string '004' (length=3)
    
    array
      0 => string 'DTM' (length=3)
      1 => string '007' (length=3)
      2 => string '20110413' (length=
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string 'TRN' (length=3)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'RATIO 12FT' (length=10)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string 'MAC' (length=3)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'CARINDC' (length=7)
    
    array
      0 => string 'MEA' (length=3)
      1 => string '' (length=0)
      2 => string 'LN' (length=2)
      3 => string '125.0' (length=5)
      4 => string 'FT' (length=2)
    
    array
      0 => string 'MEA' (length=3)
      1 => string '' (length=0)
      2 => string 'WD' (length=2)
      3 => string '12.0' (length=4)
      4 => string 'FT' (length=2)
    
    array
      0 => string 'MEA' (length=3)
      1 => string '' (length=0)
      2 => string 'SW' (length=2)
      3 => string '0.421' (length=5)
      4 => string 'FP' (length=2)
    
    array
      0 => string 'CTP' (length=3)
      1 => string '' (length=0)
      2 => string 'LPR' (length=3)
      3 => string '9.790' (length=5)
      4 => string '' (length=0)
      5 => string 'SY' (length=2)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'ST' (length=2)
    
    array
      0 => string 'CTP' (length=3)
      1 => string '' (length=0)
      2 => string 'LPR' (length=3)
      3 => string '10.490' (length=6)
      4 => string '' (length=0)
      5 => string 'SY' (length=2)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'CT' (length=2)
    
    array
      0 => string 'SLN' (length=3)
      1 => string '1' (length=1)
      2 => string '' (length=0)
      3 => string 'O' (length=1)
      4 => string '' (length=0)
      5 => string '' (length=0)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'SK' (length=2)
      10 => string 'RKDA1010255' (length=11)
      11 => string '' (length=0)
      12 => string '' (length=0)
      13 => string '' (length=0)
      14 => string '' (length=0)
      15 => string 'ST' (length=2)
      16 => string 'A10' (length=3)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '73' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'PROPORTION' (length=10)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '35' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string '10255' (length=5)
    
    array
      0 => string 'SLN' (length=3)
      1 => string '2' (length=1)
      2 => string '' (length=0)
      3 => string 'O' (length=1)
      4 => string '' (length=0)
      5 => string '' (length=0)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'SK' (length=2)
      10 => string 'RKDA1010351' (length=11)
      11 => string '' (length=0)
      12 => string '' (length=0)
      13 => string '' (length=0)
      14 => string '' (length=0)
      15 => string 'ST' (length=2)
      16 => string 'A10' (length=3)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '73' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'EQUATION' (length=
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '35' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string '10351' (length=5)
    
    array
      0 => string 'SLN' (length=3)
      1 => string '3' (length=1)
      2 => string '' (length=0)
      3 => string 'O' (length=1)
      4 => string '' (length=0)
      5 => string '' (length=0)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'SK' (length=2)
      10 => string 'RKDA1010356' (length=11)
      11 => string '' (length=0)
      12 => string '' (length=0)
      13 => string '' (length=0)
      14 => string '' (length=0)
      15 => string 'ST' (length=2)
      16 => string 'A10' (length=3)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '73' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'QUOTA' (length=5)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '35' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string '10356' (length=5)
    
    array
      0 => string 'SLN' (length=3)
      1 => string '4' (length=1)
      2 => string '' (length=0)
      3 => string 'O' (length=1)
      4 => string '' (length=0)
      5 => string '' (length=0)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'SK' (length=2)
      10 => string 'RKDA1010451' (length=11)
      11 => string '' (length=0)
      12 => string '' (length=0)
      13 => string '' (length=0)
      14 => string '' (length=0)
      15 => string 'ST' (length=2)
      16 => string 'A10' (length=3)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '73' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'RATE' (length=4)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '35' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string '10451' (length=5)
    
    array
      0 => string 'SLN' (length=3)
      1 => string '5' (length=1)
      2 => string '' (length=0)
      3 => string 'O' (length=1)
      4 => string '' (length=0)
      5 => string '' (length=0)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'SK' (length=2)
      10 => string 'RKDA1010455' (length=11)
      11 => string '' (length=0)
      12 => string '' (length=0)
      13 => string '' (length=0)
      14 => string '' (length=0)
      15 => string 'ST' (length=2)
      16 => string 'A10' (length=3)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '73' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'FRACTION' (length=
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '35' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string '10455' (length=5)
    
    array
      0 => string 'SLN' (length=3)
      1 => string '6' (length=1)
      2 => string '' (length=0)
      3 => string 'O' (length=1)
      4 => string '' (length=0)
      5 => string '' (length=0)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'SK' (length=2)
      10 => string 'RKDA1010458' (length=11)
      11 => string '' (length=0)
      12 => string '' (length=0)
      13 => string '' (length=0)
      14 => string '' (length=0)
      15 => string 'ST' (length=2)
      16 => string 'A10' (length=3)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '73' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'PERCENTAGE' (length=10)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '35' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string '10458' (length=5)
    
    array
      0 => string 'SLN' (length=3)
      1 => string '7' (length=1)
      2 => string '' (length=0)
      3 => string 'O' (length=1)
      4 => string '' (length=0)
      5 => string '' (length=0)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'SK' (length=2)
      10 => string 'RKDA1010555' (length=11)
      11 => string '' (length=0)
      12 => string '' (length=0)
      13 => string '' (length=0)
      14 => string '' (length=0)
      15 => string 'ST' (length=2)
      16 => string 'A10' (length=3)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '73' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'DIVISION' (length=
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '35' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string '10555' (length=5)
    
    array
      0 => string 'SLN' (length=3)
      1 => string '8' (length=1)
      2 => string '' (length=0)
      3 => string 'O' (length=1)
      4 => string '' (length=0)
      5 => string '' (length=0)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'SK' (length=2)
      10 => string 'RKDA1010556' (length=11)
      11 => string '' (length=0)
      12 => string '' (length=0)
      13 => string '' (length=0)
      14 => string '' (length=0)
      15 => string 'ST' (length=2)
      16 => string 'A10' (length=3)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '73' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'STANDARD' (length=
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '35' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string '10556' (length=5)
    
    array
      0 => string 'SLN' (length=3)
      1 => string '9' (length=1)
      2 => string '' (length=0)
      3 => string 'O' (length=1)
      4 => string '' (length=0)
      5 => string '' (length=0)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'SK' (length=2)
      10 => string 'RKDA1010751' (length=11)
      11 => string '' (length=0)
      12 => string '' (length=0)
      13 => string '' (length=0)
      14 => string '' (length=0)
      15 => string 'ST' (length=2)
      16 => string 'A10' (length=3)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '73' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'QUALITY' (length=7)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '35' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string '10751' (length=5)
    
    array
      0 => string 'SLN' (length=3)
      1 => string '10' (length=2)
      2 => string '' (length=0)
      3 => string 'O' (length=1)
      4 => string '' (length=0)
      5 => string '' (length=0)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'SK' (length=2)
      10 => string 'RKDA1010752' (length=11)
      11 => string '' (length=0)
      12 => string '' (length=0)
      13 => string '' (length=0)
      14 => string '' (length=0)
      15 => string 'ST' (length=2)
      16 => string 'A10' (length=3)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '73' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'SCALE' (length=5)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '35' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string '10752' (length=5)
    
    array
      0 => string 'SLN' (length=3)
      1 => string '11' (length=2)
      2 => string '' (length=0)
      3 => string 'O' (length=1)
      4 => string '' (length=0)
      5 => string '' (length=0)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'SK' (length=2)
      10 => string 'RKDA1010755' (length=11)
      11 => string '' (length=0)
      12 => string '' (length=0)
      13 => string '' (length=0)
      14 => string '' (length=0)
      15 => string 'ST' (length=2)
      16 => string 'A10' (length=3)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '73' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'FORMULA' (length=7)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '35' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string '10755' (length=5)
    
    array
      0 => string 'SLN' (length=3)
      1 => string '12' (length=2)
      2 => string '' (length=0)
      3 => string 'O' (length=1)
      4 => string '' (length=0)
      5 => string '' (length=0)
      6 => string '' (length=0)
      7 => string '' (length=0)
      8 => string '' (length=0)
      9 => string 'SK' (length=2)
      10 => string 'RKDA1010756' (length=11)
      11 => string '' (length=0)
      12 => string '' (length=0)
      13 => string '' (length=0)
      14 => string '' (length=0)
      15 => string 'ST' (length=2)
      16 => string 'A10' (length=3)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '73' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string 'MEASUREMENT' (length=11)
    
    array
      0 => string 'PID' (length=3)
      1 => string 'F' (length=1)
      2 => string '35' (length=2)
      3 => string '' (length=0)
      4 => string '' (length=0)
      5 => string '10756' (length=5)
    
    

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.