mysql - php mysqli get data showing array results but cannot echo (shows NULL) -


so script have done , using var_dump showing results when var_dump $row['blah']; showing null though can see not when var_dump($row) - want echo $customer_name example show nothing , not sure why.

any ideas?

output:

object(mysqli_result)#1 (5) { ["current_field"]=> int(0) ["field_count"]=> int(34) ["lengths"]=> array(34) { [0]=> int(2) [1]=> int(4) [2]=> int(23) [3]=> int(1) [4]=> int(7) [5]=> int(6) [6]=> int(7) [7]=> int(2) [8]=> int(4) [9]=> int(10) [10]=> int(10) [11]=> int(3) [12]=> int(2) [13]=> int(3) [14]=> int(2) [15]=> int(3) [16]=> int(27) [17]=> int(4) [18]=> int(2) [19]=> int(4) [20]=> int(13) [21]=> int(23) [22]=> int(15) [23]=> int(0) [24]=> int(6) [25]=> int(5) [26]=> int(8) [27]=> int(11) [28]=> int(13) [29]=> int(15) [30]=> int(0) [31]=> int(6) [32]=> int(5) [33]=> int(8) } ["num_rows"]=> int(2) ["type"]=> int(0) } array(28) { ["id"]=> string(2) "21" ["invoice"]=> string(4) "1000" ["product"]=> string(23) "versa table - blue jazz" ["qty"]=> string(1) "3" ["price"]=> string(7) "149.000" ["discount"]=> string(3) "134" ["subtotal"]=> string(3) "462" ["invoice_date"]=> string(10) "20/05/2015" ["invoice_due_date"]=> string(10) "13/05/2015" ["shipping"]=> string(2) "20" ["vat"]=> string(2) "92" ["total"]=> string(3) "482" ["notes"]=> string(27) "please leave next door" ["status"]=> string(4) "open" ["name"]=> string(13) "james brandon" ["email"]=> string(23) "james@ambientlounge.com" ["address_1"]=> string(15) "5 frampton road" ["address_2"]=> string(0) "" ["town"]=> string(6) "epping" ["county"]=> string(5) "essex" ["postcode"]=> string(8) "cm16 6rp" ["phone"]=> string(11) "07718090809" ["name_ship"]=> string(13) "james brandon" ["address_1_ship"]=> string(15) "5 frampton road" ["address_2_ship"]=> string(0) "" ["town_ship"]=> string(6) "epping" ["county_ship"]=> string(5) "essex" ["postcode_ship"]=> string(8) "cm16 6rp" } null 

code:

include('includes/config.php'); include('header.php'); include('functions.php');  $getid = $_get['id'];  // connect database $mysqli = new mysqli(database_host, database_user, database_pass, database_name);  // output connection error if ($mysqli->connect_error) {     die('error : ('.$mysqli->connect_errno .') '. $mysqli->connect_error); }  // query $query = "select p.*, i.*, c.*             invoice_items p              join invoices on i.invoice = p.invoice             join customers c on c.invoice = i.invoice             p.invoice = '" . $mysqli->real_escape_string($getid) . "'";  $result = mysqli_query($mysqli, $query); $row = mysqli_fetch_assoc($result);  var_dump($result);  // mysqli select query if($result) {         var_dump($row);         $customer_name = $row['customer_name']; // customer name         $customer_email = $row['customer_email']; // customer email         $customer_address_1 = $row['customer_address_1']; // customer address         $customer_address_2 = $row['customer_address_2']; // customer address         $customer_town = $row['customer_town']; // customer town         $customer_county = $row['customer_county']; // customer county         $customer_postcode = $row['customer_postcode']; // customer postcode         $customer_phone = $row['customer_phone']; // customer phone number          //shipping         $customer_name_ship = $row['customer_name_ship']; // customer name (shipping)         $customer_address_1_ship = $row['customer_address_1_ship']; // customer address (shipping)         $customer_address_2_ship = $row['customer_address_2_ship']; // customer address (shipping)         $customer_town_ship = $row['customer_town_ship']; // customer town (shipping)         $customer_county_ship = $row['customer_county_ship']; // customer county (shipping)         $customer_postcode_ship = $row['customer_postcode_ship']; // customer postcode (shipping)          // invoice details         $invoice_number = $row['invoice_id']; // invoice number         $invoice_date = $row['invoice_date']; // invoice date         $invoice_due_date = $row['invoice_due_date']; // invoice due date         $invoice_subtotal = $row['invoice_subtotal']; // invoice sub-total         $invoice_shipping = $row['invoice_shipping']; // invoice shipping amount         $invoice_discount = $row['invoice_discount']; // invoice discount         $invoice_vat = $row['invoice_vat']; // invoice vat         $invoice_total = $row['invoice_total']; // invoice total         $invoice_notes = $row['invoice_notes']; // invoice notes         $invoice_status = $row['invoice_status']; // invoice status          var_dump($row['customer_name']); }  ?>          <h1>edit invoice (<?php echo $getid; ?>)</h1>         <hr><?php var_dump($row['customer_name']); ?>          <div id="response" class="alert alert-success" style="display:none;">             <a href="#" class="close" data-dismiss="alert">&times;</a>             <div class="message"></div>         </div>          <form method="post" id="create_invoice">             <input type="hidden" name="action" value="create_invoice">             <div class="row">                 <div class="col-xs-5">                     <h1>                         <img src="<?php echo company_logo ?>" class="img-responsive">                     </h1>                 </div>                 <div class="col-xs-7 text-right">                     <div class="row">                         <div class="col-xs-9">                             <h1>invoice</h1>                         </div>                         <div class="col-xs-3">                             <select name="invoice_status" id="invoice_status" class="form-control">                                 <option value="open" <?php if($invoice_status == "open"){?>selected<?php } ?>>open</option>                                 <option value="paid" <?php if($invoice_status == "paid"){?>selected<?php } ?>>paid</option>                             </select>                         </div>                     </div>                     <div class="col-xs-4 no-padding-right">                         <div class="form-group">                             <div class="input-group date" id="invoice_date">                                 <input type="text" class="form-control required" name="invoice_date" placeholder="select invoice date" data-date-format="<?php echo date_format ?>" value="<?php echo $invoice_date; ?>" />                                 <span class="input-group-addon">                                     <span class="glyphicon glyphicon-calendar"></span>                                 </span>                             </div>                         </div>                     </div>                     <div class="col-xs-4">                         <div class="form-group">                             <div class="input-group date" id="invoice_due_date">                                 <input type="text" class="form-control required" name="invoice_due_date" placeholder="select due date" data-date-format="<?php echo date_format ?>" value="<?php echo $invoice_due_date; ?>" />                                 <span class="input-group-addon">                                     <span class="glyphicon glyphicon-calendar"></span>                                 </span>                             </div>                         </div>                     </div>                     <div class="input-group col-xs-4 float-right">                         <span class="input-group-addon">#<?php echo invoice_prefix ?></span>                         <input type="text" name="invoice_id" id="invoice_id" class="form-control required" placeholder="invoice number" aria-describedby="sizing-addon1" value="<?php echo $getid; ?>">                     </div>                 </div>             </div>             <div class="row">                 <div class="col-xs-6">                     <div class="panel panel-default">                         <div class="panel-heading">                             <h4>customer information</h4>                             <div class="clear"></div>                         </div>                         <div class="panel-body form-group form-group-sm">                             <div class="row">                                 <div class="col-xs-6">                                     <div class="form-group">                                         <input type="text" class="form-control margin-bottom copy-input required" name="customer_name" id="customer_name" placeholder="enter name" tabindex="1" value="<?php echo $customer_name; ?>">                                     </div>                                     <div class="form-group">                                         <input type="text" class="form-control margin-bottom copy-input required" name="customer_address_1" id="customer_address_1" placeholder="address 1" tabindex="3" value="<?php echo $customer_address_1; ?>">                                         </div>                                     <div class="form-group">                                         <input type="text" class="form-control margin-bottom copy-input required" name="customer_town" id="customer_town" placeholder="town" tabindex="5" value="<?php echo $customer_town; ?>">                                             </div>                                     <div class="form-group no-margin-bottom">                                         <input type="text" class="form-control copy-input required" name="customer_postcode" id="customer_postcode" placeholder="postcode" tabindex="7" value="<?php echo $customer_postcode; ?>">                                                       </div>                                 </div>                                 <div class="col-xs-6">                                     <div class="input-group float-right margin-bottom">                                         <span class="input-group-addon">@</span>                                         <input type="email" class="form-control copy-input required" name="customer_email" id="customer_email" placeholder="e-mail address" aria-describedby="sizing-addon1" tabindex="2" value="<?php echo $customer_email; ?>">                                     </div>                                     <div class="form-group">                                         <input type="text" class="form-control margin-bottom copy-input" name="customer_address_2" id="customer_address_2" placeholder="address 2" tabindex="4" value="<?php echo $customer_address_2; ?>">                                     </div>                                     <div class="form-group">                                         <input type="text" class="form-control margin-bottom copy-input required" name="customer_county" id="customer_county" placeholder="county" tabindex="6" value="<?php echo $customer_county; ?>">                                     </div>                                     <div class="form-group no-margin-bottom">                                         <input type="text" class="form-control required" name="customer_phone" id="invoice_phone" placeholder="phone number" tabindex="8" value="<?php echo $customer_phone; ?>">                                     </div>                                 </div>                             </div>                         </div>                     </div>                 </div>                 <div class="col-xs-6 text-right">                     <div class="panel panel-default">                         <div class="panel-heading">                             <h4>shipping information</h4>                         </div>                         <div class="panel-body form-group form-group-sm">                             <div class="row">                                 <div class="col-xs-6">                                     <div class="form-group">                                         <input type="text" class="form-control margin-bottom required" name="customer_name_ship" id="customer_name_ship" placeholder="enter name" tabindex="9" value="<?php echo $customer_name_ship; ?>">                                     </div>                                     <div class="form-group">                                         <input type="text" class="form-control margin-bottom" name="customer_address_2_ship" id="customer_address_2_ship" placeholder="address 2" tabindex="11" value="<?php echo $customer_address_2_ship; ?>">                                         </div>                                     <div class="form-group no-margin-bottom">                                         <input type="text" class="form-control required" name="customer_county_ship" id="customer_county_ship" placeholder="county" tabindex="13" value="<?php echo $customer_county_ship; ?>">                                     </div>                                 </div>                                 <div class="col-xs-6">                                     <div class="form-group">                                         <input type="text" class="form-control margin-bottom required" name="customer_address_1_ship" id="customer_address_1_ship" placeholder="address 1" tabindex="10" value="<?php echo $customer_address_1_ship; ?>">                                     </div>                                     <div class="form-group">                                         <input type="text" class="form-control margin-bottom required" name="customer_town_ship" id="customer_town_ship" placeholder="town" tabindex="12" value="<?php echo $customer_town_ship; ?>">                                                                </div>                                     <div class="form-group no-margin-bottom">                                         <input type="text" class="form-control required" name="customer_postcode_ship" id="customer_postcode_ship" placeholder="postcode" tabindex="14" value="<?php echo $customer_postcode_ship; ?>">                                     </div>                                 </div>                             </div>                         </div>                     </div>                 </div>             </div>             <!-- / end client details section -->             <table class="table table-bordered" id="invoice_table">                 <thead>                     <tr>                         <th width="500">                             <h4><a href="#" class="btn btn-success btn-xs add-row"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></a> item</h4>                         </th>                         <th>                             <h4>qty</h4>                         </th>                         <th>                             <h4>price</h4>                         </th>                         <th width="300">                             <h4>discount</h4>                         </th>                         <th>                             <h4>sub total</h4>                         </th>                     </tr>                 </thead>                 <tbody>                     <?php                         foreach($invoice_product $key => $value) {                             $item_product = $value;                             // $item_description = $_post['invoice_product_desc'][$key];                             $item_qty = $row['invoice_product_qty'][$key];                             $item_price = $row['invoice_product_price'][$key];                             $item_discount = $row['invoice_product_discount'][$key];                             $item_subtotal = $row['invoice_product_sub'][$key];                     ?>                     <tr>                         <td>                             <div class="form-group form-group-sm  no-margin-bottom">                                 <a href="#" class="btn btn-danger btn-xs delete-row"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a>                                 <input type="text" class="form-control form-group-sm item-input invoice_product" name="invoice_product[]" placeholder="enter item title , / or description" value="<?php echo $item_product; ?>">                                 <p class="item-select">or <a href="#">select item</a></p>                             </div>                         </td>                         <td class="text-right">                             <div class="form-group form-group-sm no-margin-bottom">                                 <input type="text" class="form-control calculate" name="invoice_product_qty[]" value="1" value="<?php echo $item_qty; ?>">                             </div>                         </td>                         <td class="text-right">                             <div class="input-group input-group-sm  no-margin-bottom">                                 <span class="input-group-addon"><?php echo currency ?></span>                                 <input type="text" class="form-control calculate invoice_product_price required" name="invoice_product_price[]" aria-describedby="sizing-addon1" placeholder="0.00" value="<?php echo $item_price; ?>">                             </div>                         </td>                         <td class="text-right">                             <div class="form-group form-group-sm  no-margin-bottom">                                 <input type="text" class="form-control calculate" name="invoice_product_discount[]" placeholder="enter % or value (ex: 10% or 10.50)" value="<?php echo $item_discount; ?>">                             </div>                         </td>                         <td class="text-right">                             <div class="input-group input-group-sm">                                 <span class="input-group-addon"><?php echo currency ?></span>                                 <input type="text" class="form-control calculate-sub" name="invoice_product_sub[]" id="invoice_product_sub" value="0.00" aria-describedby="sizing-addon1" value="<?php echo $item_subtotal; ?>" disabled>                             </div>                         </td>                     </tr>                     <?php } ?>                 </tbody>             </table>             <div id="invoice_totals" class="padding-right row text-right">                 <div class="col-xs-6">                     <div class="input-group form-group-sm textarea no-margin-bottom">                         <textarea class-"form-control" name="invoice_notes" placeholder="please enter order notes here." value="<?php echo $invoice_notes; ?>"></textarea>                     </div>                 </div>                 <div class="col-xs-6 no-padding-right">                     <div class="row">                         <div class="col-xs-3 col-xs-offset-6">                             <strong>sub total:</strong>                         </div>                         <div class="col-xs-3">                             <?php echo currency ?><span class="invoice-sub-total"> <?php echo $invoice_subtotal; ?></span>                             <input type="hidden" name="invoice_subtotal" id="invoice_subtotal" value="<?php echo $invoice_subtotal; ?>">                         </div>                     </div>                     <div class="row">                         <div class="col-xs-3 col-xs-offset-6">                             <strong>discount:</strong>                         </div>                         <div class="col-xs-3">                             <?php echo currency ?><span class="invoice-discount"> <?php echo $invoice_discount; ?></span>                             <input type="hidden" name="invoice_discount" id="invoice_discount" value="<?php echo $invoice_discount; ?>">                         </div>                     </div>                     <div class="row">                         <div class="col-xs-3 col-xs-offset-6">                             <strong class="shipping">shipping:</strong>                         </div>                         <div class="col-xs-3">                             <div class="input-group input-group-sm">                                 <span class="input-group-addon"><?php echo currency ?></span>                                 <input type="text" class="form-control calculate shipping" name="invoice_shipping" aria-describedby="sizing-addon1" placeholder="0.00" value="<?php echo $invoice_shipping; ?>">                             </div>                         </div>                     </div>                     <?php if (enable_vat == true) { ?>                     <div class="row">                         <div class="col-xs-3 col-xs-offset-6">                             <strong>tax/vat:</strong>                         </div>                         <div class="col-xs-3">                             <?php echo currency ?><span class="invoice-vat" data-enable-vat="<?php echo enable_vat ?>" data-vat-rate="<?php echo vat_rate ?>" data-vat-method="<?php echo vat_included ?>">0.00</span>                             <input type="hidden" name="invoice_vat" id="invoice_vat">                         </div>                     </div>                     <?php } ?>                     <div class="row">                         <div class="col-xs-3 col-xs-offset-6">                             <strong>total:</strong>                         </div>                         <div class="col-xs-3">                             <?php echo currency ?><span class="invoice-total"> <?php echo $invoice_total; ?></span>                             <input type="hidden" name="invoice_total" id="invoice_total" value="<?php echo $invoice_total; ?>">                         </div>                     </div>                 </div>              </div>             <div class="row">                 <div class="col-xs-12 margin-top btn-group">                     <input type="submit" id="action_edit_invoice" class="btn btn-success float-right" value="update invoice" data-loading-text="updating...">                 </div>             </div>         </form>          <div id="insert" class="modal fade">           <div class="modal-dialog">             <div class="modal-content">               <div class="modal-header">                 <button type="button" class="close" data-dismiss="modal" aria-label="close"><span aria-hidden="true">&times;</span></button>                 <h4 class="modal-title">select item</h4>               </div>               <div class="modal-body">                 <?php popproductslist(); ?>               </div>               <div class="modal-footer">                 <button type="button" data-dismiss="modal" class="btn btn-primary" id="selected">add</button>                 <button type="button" data-dismiss="modal" class="btn">cancel</button>               </div>             </div><!-- /.modal-content -->           </div><!-- /.modal-dialog -->         </div><!-- /.modal -->  <?php     include('footer.php'); ?> 

as assign data $row means $result nothing;

$row = mysqli_fetch_assoc($result);  var_dump($result);  // mysqli select query if($result) { 

you code

while ($row = mysqli_fetch_assoc($result)) {  $customer_name = $row['customer_name']; ....... } 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -