Buduję funkcję która odczytuje listę ofert, po zapytaniu odczytuję za pomocą pętli kolejne rekordy ale z niewiadomej mi przyczyny odczytuje tylko 1 rekord w bazie i wyskakuje mi błąd:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/virtual/strony/alpha/htdocs/OffertList.inc on line 17
Co ciekawe zanim wyskoczy błąd pobiera zawsze pierwszą pozycję w bazie danych natomiast następnych już nie i wyskakuje ten błąd.
W linii 17 jest:
while($offer = mysql_fetch_array($result))
Wygląd tablicy zapytania do bazy:
Array
(
[0] => 30176
[id] => 30176
[1] => 2
[AddUser] => 2
[2] => 2008-08-29 18:23:19
[AddDate] => 2008-08-29 18:23:19
[3] => 2010-08-08 10:21:08
[StartDate] => 2010-08-08 10:21:08
[4] => 2012-01-01 10:21:08
[EndDate] => 2012-01-01 10:21:08
[5] => 0
[BIN] => 0
[6] => 0
[OfferDay] => 0
[7] => 1
[Dealer] => 1
[8] => 1
[Active] => 1
[9] => 0
[mobile_ID] => 0
[10] => 0
[otomoto_ID] => 0
[11] => 0
[trader_ID] => 0
[12] => a:1:{i:1;s:0:"";}
[MobilePicturesArray] => a:1:{i:1;s:0:"";}
[13] => a:10:{i:1;N;i:2;N;i:3;N;i:4;N;i:5;N;i:6;N;i:7;N;i:8;N;i:9;N;i:10;N;}
[autosPicturesArray] => a:10:{i:1;N;i:2;N;i:3;N;i:4;N;i:5;N;i:6;N;i:7;N;i:8;N;i:9;N;i:10;N;}
[14] => 0
[OfferType] => 0
[15] => 91
[Mark] => 91
[16] => 20
[Model] => 20
[17] => 1
[Category] => 1
[18] => Ij215J0b4JyzrG6tOj2555t06LpC9tFmCx33734j8gHeMty7D4Gc9Q3I7925g28I
[OfferHash] => Ij215J0b4JyzrG6tOj2555t06LpC9tFmCx33734j8gHeMty7D4Gc9Q3I7925g28I
[19] =>
[Title] =>
[20] => 802
[Statistics] => 802
[21] => 15125
[Price] => 15125
[22] => 2
[Currency] => 2
[23] => 2
[EngineType] => 2
[24] => 17
[EngineDesignation] => 17
[25] => 140
[EnginePower] => 140
[26] => 1
[EnginePowerUnit] => 1
[27] => 2000
[EngineCapacity] => 2000
[28] => 2005
[Yearbook] => 2005
[29] => 144420
[Mileage] => 144420
[30] => 2
[VehicleCondition] => 2
[31] => 2
[DoorsNumber] => 2
[32] => 0
[Color] => 0
[33] => 0
[ColorType] => 0
[34] => 2
[WhereIsVehicle] => 2
[35] => 0
[SeatsNumber] => 0
[36] => 0
[SportSeats] => 0
[37] => 0
[GearsNumber] => 0
[38] => 0
[Radio] => 0
[39] => 0
[RadioModel] => 0
[40] => 1
[ElectricWindows] => 1
[41] => 0
[4x4] => 0
[42] => 0
[Pneumatic] => 0
[43] => 0
[ChildSeatsIsofix] => 0
[44] => 0
[Quattro] => 0
[45] => 1
[ABS] => 1
[46] => 0
[AirBags] => 0
[47] => 0
[CarAlarm] => 0
[48] => 0
[Wheels] => 0
[49] => 0
[ASR] => 0
[50] => 0
[AutomaticGears] => 0
[51] => 0
[AutomaticRearviewMirror] => 0
[52] => 1
[CentralLocking] => 1
[53] => 0
[TintedGlass] => 0
[54] => 0
[RainSensor] => 0
[55] => 0
[PartialSkin] => 0
[56] => 0
[ExtrasSkin] => 0
[57] => 0
[ElectricMirrors] => 0
[58] => 0
[ElectricallyAdjustableSeats] => 0
[59] => 1
[ESP] => 1
[60] => 0
[Air-conditionedSeats] => 0
[61] => 0
[HeatedSeats] => 0
[62] => 0
[SeatsWithMemory] => 0
[63] => 0
[ChildSeats] => 0
[64] => 0
[Warranty] => 0
[65] => 0
[Hith] => 0
[66] => 0
[Halogens] => 0
[67] => 0
[TelephoneInstallation] => 0
[68] => 0
[Klimatronic] => 0
[69] => 0
[AirConditioning] => 0
[70] => 0
[On-boardComputer] => 0
[71] => 1
[ServiceBook] => 1
[72] => 0
[MultimediaSteeringWheel] => 0
[73] => 0
[Multitronic] => 0
[74] => 0
[Navigation] => 0
[75] => 0
[EuroStandard] => 0
[76] => 0
[HeatedWindscreen] => 0
[77] => 0
[AuxiliaryHeating] => 0
[78] => 0
[DoubleCab] => 0
[79] => 0
[Parktronic] => 0
[80] => 1
[Pilot] => 1
[81] => 0
[PneumaticSuspension] => 0
[82] => 0
[Rails] => 0
[83] => 0
[Skin] => 0
[84] => 0
[Sunroof] => 0
[85] => 0
[ElectricSunroof] => 0
[86] => 0
[Immobilizer] => 0
[87] => 0
[Tachograph] => 0
[88] => 0
[TCS] => 0
[89] => 0
[CruiseControl] => 0
[90] => 0
[Tiptronic] => 0
[91] => 0
[Velvet] => 0
[92] => 1
[PowerSteering] => 1
[93] => 0
[Xenons] => 0
[94] => 0
[XenonsLight] => 0
[95] => 0
[WiperLights] => 0
[96] => VAN///95
[AdditionalInformation] => VAN///95
[97] =>
[VehiclesDealer] =>
[98] => 0
[Premium] => 0
)
1
Kod strony wygląda tak:
$page = $_GET['N-10_nextpage']; if ($page <= 1) {$page = 0; } else {$page = $page - 1; $page = $page * 10;} _MysqlOpen(); $query = "SELECT * FROM _offerlist "; { $offer_id= $offer ['id']; $links['otomoto']= $offer ['otomoto_ID']; $links['trader'] = $offer ['trader_ID']; $links['mobile.de'] =$offer ['mobile_ID']; $links['autos'] = '?S-20_query=mobile&N-6_id='.$offer_id; $result = $_mark ->xpath('/*/osobowe/marka[@id="'.$offer ['Mark'].'"]'); $auto['marka']= $result[0]->attributes()->name; $result = $_mark ->xpath('/*/osobowe/*/model[@id="'.$offer ['Model'].'"]'); $auto['model']= $result[0]->attributes()->name; $dane['mileage'] = $offer ['Mileage']; $dane['offer_number'] = $_Number->Code($offer_id); $dane['year'] = $offer ['Yearbook']; $image = '/PICTURES/Small/'.$offer ['OfferHash'].'.jpg'; $_theme->OffertList ($links, $image, $auto, $titleinfo, $dane); }
Próbowałem znaleźć przyczynę na wiele sposobów ale na razie przyczyny nie znalazłem.
W bazie jest ponad 2500 ofert.