Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Yakindo

Members
  • Joined

  • Last visited

Solutions

  1. Yakindo's post in Reading associative arrays? was marked as the answer   
    In answering the title of your thread, the best way I've found to read arrays is using the function print_r();:
    <?php $array_var = array(); // the var which stores the array ?> <pre><?php print_r($array_var); ?></pre> This will output the array in an easy-to-read format, where all the keys you need to access the array items are defined.
     
    For this array:
    <?php $new_invoice = array( array( "Type"=>"ACCREC", "Contact" => array( "Name" => "Income" ), "Date" => "2013-12-31", "DueDate" => "2013-12-31", "Status" => "DRAFT", "LineAmountTypes" => "Exclusive", "LineItems"=> array( "LineItem" => array( array( "Description" => "Sales - Wet", "Quantity" => "1.0000", "UnitAmount" => "2500.00", "AccountCode" => "200" ), array( "Description" => "Sales - Pool Table", "Quantity" => "1.0000", "UnitAmount" => "325.25", "AccountCode" => "200" ) ) ) ) ); ?> <pre><?php print_r($new_invoice); ?></pre> The following is outputted in the HTML:
    Array ( [0] => Array ( [Type] => ACCREC [Contact] => Array ( [Name] => Income ) [Date] => 2013-12-31 [DueDate] => 2013-12-31 [Status] => DRAFT [LineAmountTypes] => Exclusive [LineItems] => Array ( [LineItem] => Array ( [0] => Array ( [Description] => Sales - Wet [Quantity] => 1.0000 [UnitAmount] => 2500.00 [AccountCode] => 200 ) [1] => Array ( [Description] => Sales - Pool Table [Quantity] => 1.0000 [UnitAmount] => 325.25 [AccountCode] => 200 ) ) ) ) ) As you can see all of your information is stored in the 0 array key:
    $new_invoice[0] Instead of:
    $new_invoice So to access your description you will need to do the following:
    $new_invoice[0]['LineItems']['LineItem'][0]['Description']; // first line item $new_invoice[0]['LineItems']['LineItem'][1]['Description']; // second line item To add new items into your "LineItem" key, use the following code:
    $new_invoice[0]['LineItems']['LineItem'][] = array( "Description" => "", "Quantity" => "", "UnitAmount" => "", "AccountCode" => ""); To loop through the "LineItems" section, using a foreach like so would be plausable:
    <?php foreach($new_invoice[0]['LineItems']['LineItem'] as $lineItem) { $lineItem['Description']; // this is the description of the line item being looped $lineItem['Quantity']; // this is the quantity of the line item being looped $lineItem['UnitAmount']; // so on and so forth $lineItem['AccountCode']; } ?>  
     
    I hope you've found this useful.
  2. Yakindo's post in Please Help with WHERE clause was marked as the answer   
    Right for that function, all you need to do is pass through the category and the sub id, not an array of data. Just two variables (or pieces of data).
    <?php function get_item_for_sub($sel_sub, $sel_cat) { $query = "SELECT * FROM stock WHERE position = " . $sel_cat . " AND sub_pos = " . $sel_sub . ""; $item_set = mysql_query($query); confirm_query($item_set); return $item_set; } $idkRandomVar = get_item_for_sub($sel_sub['id'], $sel_cat['id']); ?> Then all you need to do is loop through data which has been returned, I don't know if this is any help, could you provide more code (obviously take out any sensitive information)
  3. Yakindo's post in How Do I Set Space Between Lines Of Sentences In Dreamweaver? was marked as the answer   
    Line height changes the space between each line of your paragraph, it's used for readability of your content

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.