需要帮助学习PHP-MySqli

时间:2016-11-11 14:33:48

标签: php-mysqlidb

当我使用这段代码时,除了数据库中的第一个条目外,我得到了我期望的结果:

[1, 1, 1, 1, 1, 1, 1]
[1, 2, 3, 4, 5, 6, 7]
[1, 3, 6, 10, 15, 21, 28]
1
28

1 个答案:

答案 0 :(得分:0)

删除第一次出现的<link rel="import" href="../../bower_components/polymer/polymer.html"> <link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html"> <link rel="import" href="../../bower_components/app-storage/app-localstorage/app-localstorage-document.html"> <link rel="import" href="../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html"> <dom-module id="my-component"> <template> <div> <paper-dropdown-menu id="location" label="Ubicaci&oacute;n" value="{{vehicle.location}}"> </paper-dropdown-menu> <paper-dropdown-menu id="city" label="Ciudad"> <paper-menu class="dropdown-content" selected="{{city.city_code}}" attr-for-selected="value" on-iron-select="estadoSeleccionado"> <template id="" is="dom-repeat" items="[[opcionesDisponibilidad]]" as="i"> <paper-item value="[[i.valor]]">[[i.texto]]</paper-item> </template> </paper-menu> </paper-dropdown-menu> </div> <iron-ajax id="ajax" method="GET" url="http://localhost:8080/ws.asmx" params="" content-type="application/x-www-form-urlencoded; charset=UTF-8" handle-as="text" on-response="handlecities" debounce-duration="300"> </iron-ajax> <app-localstorage-document id="localStorageElement" key="myapp.login_data" data="{{loginInfo}}"></app-localstorage-document> </template> <script> Polymer({ is: "my-component", properties:{ vehicle: { type: Object, value:{ id: "", plate: "", location: "" } }, cities:{ notify: true, type: Array, value: [{city_code:'0', city_name:'-'}] } }, ready:function () { this.querycities(); }, querycities: function () { if (this.$.localStorageElement.storage['myapp.login_data']){ this.$.loginInfo = JSON.parse(this.$.localStorageElement.storage['myapp.login_data']); } else return false; this.$.ajax.url = this.$.ajax.url + "/listadoCiudades"; this.$.ajax.verbose = true; this.$.ajax._boundHandleResponse = this.handlecities; this.$.ajax.params = {dispositivo:'12345', credencial: this.$.loginInfo.cred}; this.$.ajax.generateRequest(); }, handlecities: function (request) { console.log(request.response); var xPath = new SoftXpath(); xPath.registerNamespace("",""); xPath.loadXML(request.response); var cities = xPath.selectNodes("//Ciudad//*[self::Codigo|self::Nombre]"); var xPathElement = new SoftXpath(); if (cities){ for(var i = 1; i < cities.length;i++){ var c = new Object(); c.Codigo = cities[i-1].text; c.Nombre = cities[i].text; this.$.cities.push(c);// <---- Here I have not access to my polymer property ' cities '. //How to update my polymer var cities ?? //Tried also with: // this.cities --> undefined // this.$$('#myassignedId').cities --> undefined } } } }) </script> </dom-module> 。 (紧接在 Dim LastColumn As Integer Dim c2 As Integer Dim SourceCell As Range With ThisWorkbook.Sheets(SheetName) 'get last used column in row 4, ALTHOUGH THIS IS NOT NEEDED IN THIS CODE LastColumn = .Cells(4, .Columns.Count).End(xlToLeft).Column 'loop through rest of the row c2 = 2 Do Until IsEmpty(.Cells(4, c2).Value) If .Cells(1, c2).Value = MonthSel And .Cells(4, c2).Value = WkSel Then Set SourceCell = .Cells(5, c2) End If If .Cells(5, c2).Value = "" Then 'Set the source cell for filling up empty column .Cells(5, c2).Value2 = SourceCell.Value2 End If c2 = c2 + 1 Loop End With 之后的那一行)。

这一行读了一行,但是你没有做任何事情。你丢弃了第一行的数据。

作为循环的一部分,对$row = mysqli_fetch_array($query);的进一步向下的调用是正确的。你不需要在其他任何地方这样做。