Note that there are some explanatory texts on larger screens.

plurals
  1. POjson to array to mysql not cycling through data
    text
    copied!<p>hi guys i need to get this json data into my db so i have allready collected the details of another structure from the same site using a script similar to the one below but that was only 8 items long, this behaves as if it worked but nothing happens to the table in question heres the json:</p> <pre><code>[{"country":"Sri Lanka","countryCode":"LK"},{"country":"Syria","countryCode":"SY"},{"country":"Kenya","countryCode":"KE"},{"country":"Cambodia","countryCode":"KH"},{"country":"Mongolia","countryCode":"MN"},{"country":"Senegal","countryCode":"SN"},{"country":"Jordan","countryCode":"JO"},{"country":"Sweden","countryCode":"SE"},{"country":"United Kingdom","countryCode":"GB"},{"country":"Austria","countryCode":"AT"},{"country":"Israel","countryCode":"IL"},{"country":"Paraguay","countryCode":"PY"},{"country":"Jamaica","countryCode":"JM"},{"country":"Mexico","countryCode":"MX"},{"country":"Chile","countryCode":"CL"},{"country":"Canada","countryCode":"CA"},{"country":"Bulgaria","countryCode":"BG"},{"country":"Monaco","countryCode":"MC"},{"country":"Puerto Rico","countryCode":"PR"},{"country":"Lebanon","countryCode":"LB"},{"country":"Ecuador","countryCode":"EC"},{"country":"Palau","countryCode":"PW"},{"country":"Guam","countryCode":"GU"},{"country":"Macedonia","countryCode":"MK"},{"country":"Reunion","countryCode":"RE"},{"country":"Botswana","countryCode":"BW"},{"country":"Libya","countryCode":"LY"},{"country":"Togo","countryCode":"TG"},{"country":"Thailand","countryCode":"TH"},{"country":"Malaysia","countryCode":"MY"},{"country":"Spain","countryCode":"ES"},{"country":"Denmark","countryCode":"DK"},{"country":"Dominican Republic","countryCode":"DO"},{"country":"Belize","countryCode":"BZ"},{"country":"Nicaragua","countryCode":"NI"},{"country":"Venezuela","countryCode":"VE"},{"country":"Latvia","countryCode":"LV"},{"country":"Azerbaijan","countryCode":"AZ"},{"country":"Moldova","countryCode":"MD"},{"country":"United Arab Emirates","countryCode":"AE"},{"country":"Malta","countryCode":"MT"},{"country":"Swaziland","countryCode":"SZ"},{"country":"Yemen","countryCode":"YE"},{"country":"El Salvador","countryCode":"SV"},{"country":"Malawi","countryCode":"MW"},{"country":"French Guiana","countryCode":"GF"},{"country":"Bangladesh","countryCode":"BD"},{"country":"Liechtenstein","countryCode":"LI"},{"country":"San Marino","countryCode":"SM"},{"country":"Belarus","countryCode":"BY"},{"country":"Mozambique","countryCode":"MZ"},{"country":"Iran","countryCode":"IR"},{"country":"Pakistan","countryCode":"PK"},{"country":"Russia","countryCode":"RU"},{"country":"Mauritius","countryCode":"MU"},{"country":"Taiwan","countryCode":"TW"},{"country":"Portugal","countryCode":"PT"},{"country":"Nigeria","countryCode":"NG"},{"country":"Greece","countryCode":"GR"},{"country":"Switzerland","countryCode":"CH"},{"country":"Kuwait","countryCode":"KW"},{"country":"Luxembourg","countryCode":"LU"},{"country":"Czech Republic","countryCode":"CZ"},{"country":"Croatia","countryCode":"HR"},{"country":"Argentina","countryCode":"AR"},{"country":"Egypt","countryCode":"EG"},{"country":"Costa Rica","countryCode":"CR"},{"country":"United States","countryCode":"US"},{"country":"Lithuania","countryCode":"LT"},{"country":"Kazakhstan","countryCode":"KZ"},{"country":"Serbia","countryCode":"RS"},{"country":"Estonia","countryCode":"EE"},{"country":"Singapore","countryCode":"SG"},{"country":"Micronesia","countryCode":"FM"},{"country":"Albania","countryCode":"AL"},{"country":"Mali","countryCode":"ML"},{"country":"Uganda","countryCode":"UG"},{"country":"South Africa","countryCode":"ZA"},{"country":"Myanmar","countryCode":"MM"},{"country":"Australia","countryCode":"AU"},{"country":"Fiji","countryCode":"FJ"},{"country":"Italy","countryCode":"IT"},{"country":"Andorra","countryCode":"AD"},{"country":"Norway","countryCode":"NO"},{"country":"Brazil","countryCode":"BR"},{"country":"Uruguay","countryCode":"UY"},{"country":"Guatemala","countryCode":"GT"},{"country":"French Polynesia","countryCode":"PF"},{"country":"Seychelles","countryCode":"SC"},{"country":"Barbados","countryCode":"BB"},{"country":"Montenegro","countryCode":"ME"},{"country":"Laos","countryCode":"LA"},{"country":"Cook Islands","countryCode":"CK"},{"country":"Cayman Islands","countryCode":"KY"},{"country":"Gabon","countryCode":"GA"},{"country":"Saudi Arabia","countryCode":"SA"},{"country":"Vietnam","countryCode":"VN"},{"country":"Philippines","countryCode":"PH"},{"country":"South Korea","countryCode":"KR"},{"country":"Japan","countryCode":"JP"},{"country":"Vanuatu","countryCode":"VU"},{"country":"New Zealand","countryCode":"NZ"},{"country":"Tunisia","countryCode":"TN"},{"country":"Ireland","countryCode":"IE"},{"country":"Slovenia","countryCode":"SI"},{"country":"Suriname","countryCode":"SR"},{"country":"Finland","countryCode":"FI"},{"country":"Aruba","countryCode":"AW"},{"country":"Nepal","countryCode":"NP"},{"country":"Faroe Islands","countryCode":"FO"},{"country":"Sudan","countryCode":"SD"},{"country":"Indonesia","countryCode":"ID"},{"country":"China","countryCode":"CN"},{"country":"Maldives","countryCode":"MV"},{"country":"Uzbekistan","countryCode":"UZ"},{"country":"Hong Kong","countryCode":"HK"},{"country":"Algeria","countryCode":"DZ"},{"country":"Germany","countryCode":"DE"},{"country":"Oman","countryCode":"OM"},{"country":"France","countryCode":"FR"},{"country":"Slovakia","countryCode":"SK"},{"country":"Poland","countryCode":"PL"},{"country":"Bahamas","countryCode":"BS"},{"country":"Guadeloupe","countryCode":"GP"},{"country":"Colombia","countryCode":"CO"},{"country":"Bolivia","countryCode":"BO"},{"country":"Ukraine","countryCode":"UA"},{"country":"Netherlands Antilles","countryCode":"AN"},{"country":"Tonga","countryCode":"TO"},{"country":"Georgia","countryCode":"GE"},{"country":"Ethiopia","countryCode":"ET"},{"country":"Bermuda","countryCode":"BM"},{"country":"Cyprus","countryCode":"CY"},{"country":"Gambia","countryCode":"GM"},{"country":"Morocco","countryCode":"MA"},{"country":"Hungary","countryCode":"HU"},{"country":"Honduras","countryCode":"HN"},{"country":"Peru","countryCode":"PE"},{"country":"Romania","countryCode":"RO"},{"country":"Armenia","countryCode":"AM"},{"country":"New Caledonia","countryCode":"NC"},{"country":"Zambia","countryCode":"ZM"},{"country":"India","countryCode":"IN"},{"country":"Tanzania","countryCode":"TZ"},{"country":"Netherlands","countryCode":"NL"},{"country":"Belgium","countryCode":"BE"},{"country":"Turkey","countryCode":"TR"},{"country":"Namibia","countryCode":"NA"},{"country":"Grenada","countryCode":"GD"},{"country":"Qatar","countryCode":"QA"},{"country":"Iceland","countryCode":"IS"},{"country":"Bahrain","countryCode":"BH"},{"country":"Zimbabwe","countryCode":"ZW"},{"country":"Gibraltar","countryCode":"GI"},{"country":"Cameroon","countryCode":"CM"}] </code></pre> <p>then this is what the array looks like:</p> <pre><code>array(155) { [0]=&gt; array(2) { ["country"]=&gt; string(9) "Sri Lanka" ["countryCode"]=&gt; string(2) "LK" } [1]=&gt; array(2) { ["country"]=&gt; string(5) "Syria" ["countryCode"]=&gt; string(2) "SY" } [2]=&gt; array(2) { ["country"]=&gt; string(5) "Kenya" ["countryCode"]=&gt; string(2) "KE" } [3]=&gt; array(2) { ["country"]=&gt; string(8) "Cambodia" ["countryCode"]=&gt; string(2) "KH" } [4]=&gt; array(2) { ["country"]=&gt; string(8) "Mongolia" ["countryCode"]=&gt; string(2) "MN" } [5]=&gt; array(2) { ["country"]=&gt; string(7) "Senegal" ["countryCode"]=&gt; string(2) "SN" } [6]=&gt; array(2) { ["country"]=&gt; string(6) "Jordan" ["countryCode"]=&gt; string(2) "JO" } [7]=&gt; array(2) { ["country"]=&gt; string(6) "Sweden" ["countryCode"]=&gt; string(2) "SE" } [8]=&gt; array(2) { ["country"]=&gt; string(14) "United Kingdom" ["countryCode"]=&gt; string(2) "GB" } [9]=&gt; array(2) { ["country"]=&gt; string(7) "Austria" ["countryCode"]=&gt; string(2) "AT" } [10]=&gt; array(2) { ["country"]=&gt; string(6) "Israel" ["countryCode"]=&gt; string(2) "IL" } [11]=&gt; array(2) { ["country"]=&gt; string(8) "Paraguay" ["countryCode"]=&gt; string(2) "PY" } [12]=&gt; array(2) { ["country"]=&gt; string(7) "Jamaica" ["countryCode"]=&gt; string(2) "JM" } [13]=&gt; array(2) { ["country"]=&gt; string(6) "Mexico" ["countryCode"]=&gt; string(2) "MX" } [14]=&gt; array(2) { ["country"]=&gt; string(5) "Chile" ["countryCode"]=&gt; string(2) "CL" } [15]=&gt; array(2) { ["country"]=&gt; string(6) "Canada" ["countryCode"]=&gt; string(2) "CA" } [16]=&gt; array(2) { ["country"]=&gt; string(8) "Bulgaria" ["countryCode"]=&gt; string(2) "BG" } [17]=&gt; array(2) { ["country"]=&gt; string(6) "Monaco" ["countryCode"]=&gt; string(2) "MC" } [18]=&gt; array(2) { ["country"]=&gt; string(11) "Puerto Rico" ["countryCode"]=&gt; string(2) "PR" } [19]=&gt; array(2) { ["country"]=&gt; string(7) "Lebanon" ["countryCode"]=&gt; string(2) "LB" } [20]=&gt; array(2) { ["country"]=&gt; string(7) "Ecuador" ["countryCode"]=&gt; string(2) "EC" } [21]=&gt; array(2) { ["country"]=&gt; string(5) "Palau" ["countryCode"]=&gt; string(2) "PW" } [22]=&gt; array(2) { ["country"]=&gt; string(4) "Guam" ["countryCode"]=&gt; string(2) "GU" } [23]=&gt; array(2) { ["country"]=&gt; string(9) "Macedonia" ["countryCode"]=&gt; string(2) "MK" } [24]=&gt; array(2) { ["country"]=&gt; string(7) "Reunion" ["countryCode"]=&gt; string(2) "RE" } [25]=&gt; array(2) { ["country"]=&gt; string(8) "Botswana" ["countryCode"]=&gt; string(2) "BW" } [26]=&gt; array(2) { ["country"]=&gt; string(5) "Libya" ["countryCode"]=&gt; string(2) "LY" } [27]=&gt; array(2) { ["country"]=&gt; string(4) "Togo" ["countryCode"]=&gt; string(2) "TG" } [28]=&gt; array(2) { ["country"]=&gt; string(8) "Thailand" ["countryCode"]=&gt; string(2) "TH" } [29]=&gt; array(2) { ["country"]=&gt; string(8) "Malaysia" ["countryCode"]=&gt; string(2) "MY" } [30]=&gt; array(2) { ["country"]=&gt; string(5) "Spain" ["countryCode"]=&gt; string(2) "ES" } [31]=&gt; array(2) { ["country"]=&gt; string(7) "Denmark" ["countryCode"]=&gt; string(2) "DK" } [32]=&gt; array(2) { ["country"]=&gt; string(18) "Dominican Republic" ["countryCode"]=&gt; string(2) "DO" } [33]=&gt; array(2) { ["country"]=&gt; string(6) "Belize" ["countryCode"]=&gt; string(2) "BZ" } [34]=&gt; array(2) { ["country"]=&gt; string(9) "Nicaragua" ["countryCode"]=&gt; string(2) "NI" } [35]=&gt; array(2) { ["country"]=&gt; string(9) "Venezuela" ["countryCode"]=&gt; string(2) "VE" } [36]=&gt; array(2) { ["country"]=&gt; string(6) "Latvia" ["countryCode"]=&gt; string(2) "LV" } [37]=&gt; array(2) { ["country"]=&gt; string(10) "Azerbaijan" ["countryCode"]=&gt; string(2) "AZ" } [38]=&gt; array(2) { ["country"]=&gt; string(7) "Moldova" ["countryCode"]=&gt; string(2) "MD" } [39]=&gt; array(2) { ["country"]=&gt; string(20) "United Arab Emirates" ["countryCode"]=&gt; string(2) "AE" } [40]=&gt; array(2) { ["country"]=&gt; string(5) "Malta" ["countryCode"]=&gt; string(2) "MT" } [41]=&gt; array(2) { ["country"]=&gt; string(9) "Swaziland" ["countryCode"]=&gt; string(2) "SZ" } [42]=&gt; array(2) { ["country"]=&gt; string(5) "Yemen" ["countryCode"]=&gt; string(2) "YE" } [43]=&gt; array(2) { ["country"]=&gt; string(11) "El Salvador" ["countryCode"]=&gt; string(2) "SV" } [44]=&gt; array(2) { ["country"]=&gt; string(6) "Malawi" ["countryCode"]=&gt; string(2) "MW" } [45]=&gt; array(2) { ["country"]=&gt; string(13) "French Guiana" ["countryCode"]=&gt; string(2) "GF" } [46]=&gt; array(2) { ["country"]=&gt; string(10) "Bangladesh" ["countryCode"]=&gt; string(2) "BD" } [47]=&gt; array(2) { ["country"]=&gt; string(13) "Liechtenstein" ["countryCode"]=&gt; string(2) "LI" } [48]=&gt; array(2) { ["country"]=&gt; string(10) "San Marino" ["countryCode"]=&gt; string(2) "SM" } [49]=&gt; array(2) { ["country"]=&gt; string(7) "Belarus" ["countryCode"]=&gt; string(2) "BY" } [50]=&gt; array(2) { ["country"]=&gt; string(10) "Mozambique" ["countryCode"]=&gt; string(2) "MZ" } [51]=&gt; array(2) { ["country"]=&gt; string(4) "Iran" ["countryCode"]=&gt; string(2) "IR" } [52]=&gt; array(2) { ["country"]=&gt; string(8) "Pakistan" ["countryCode"]=&gt; string(2) "PK" } [53]=&gt; array(2) { ["country"]=&gt; string(6) "Russia" ["countryCode"]=&gt; string(2) "RU" } [54]=&gt; array(2) { ["country"]=&gt; string(9) "Mauritius" ["countryCode"]=&gt; string(2) "MU" } [55]=&gt; array(2) { ["country"]=&gt; string(6) "Taiwan" ["countryCode"]=&gt; string(2) "TW" } [56]=&gt; array(2) { ["country"]=&gt; string(8) "Portugal" ["countryCode"]=&gt; string(2) "PT" } [57]=&gt; array(2) { ["country"]=&gt; string(7) "Nigeria" ["countryCode"]=&gt; string(2) "NG" } [58]=&gt; array(2) { ["country"]=&gt; string(6) "Greece" ["countryCode"]=&gt; string(2) "GR" } [59]=&gt; array(2) { ["country"]=&gt; string(11) "Switzerland" ["countryCode"]=&gt; string(2) "CH" } [60]=&gt; array(2) { ["country"]=&gt; string(6) "Kuwait" ["countryCode"]=&gt; string(2) "KW" } [61]=&gt; array(2) { ["country"]=&gt; string(10) "Luxembourg" ["countryCode"]=&gt; string(2) "LU" } [62]=&gt; array(2) { ["country"]=&gt; string(14) "Czech Republic" ["countryCode"]=&gt; string(2) "CZ" } [63]=&gt; array(2) { ["country"]=&gt; string(7) "Croatia" ["countryCode"]=&gt; string(2) "HR" } [64]=&gt; array(2) { ["country"]=&gt; string(9) "Argentina" ["countryCode"]=&gt; string(2) "AR" } [65]=&gt; array(2) { ["country"]=&gt; string(5) "Egypt" ["countryCode"]=&gt; string(2) "EG" } [66]=&gt; array(2) { ["country"]=&gt; string(10) "Costa Rica" ["countryCode"]=&gt; string(2) "CR" } [67]=&gt; array(2) { ["country"]=&gt; string(13) "United States" ["countryCode"]=&gt; string(2) "US" } [68]=&gt; array(2) { ["country"]=&gt; string(9) "Lithuania" ["countryCode"]=&gt; string(2) "LT" } [69]=&gt; array(2) { ["country"]=&gt; string(10) "Kazakhstan" ["countryCode"]=&gt; string(2) "KZ" } [70]=&gt; array(2) { ["country"]=&gt; string(6) "Serbia" ["countryCode"]=&gt; string(2) "RS" } [71]=&gt; array(2) { ["country"]=&gt; string(7) "Estonia" ["countryCode"]=&gt; string(2) "EE" } [72]=&gt; array(2) { ["country"]=&gt; string(9) "Singapore" ["countryCode"]=&gt; string(2) "SG" } [73]=&gt; array(2) { ["country"]=&gt; string(10) "Micronesia" ["countryCode"]=&gt; string(2) "FM" } [74]=&gt; array(2) { ["country"]=&gt; string(7) "Albania" ["countryCode"]=&gt; string(2) "AL" } [75]=&gt; array(2) { ["country"]=&gt; string(4) "Mali" ["countryCode"]=&gt; string(2) "ML" } [76]=&gt; array(2) { ["country"]=&gt; string(6) "Uganda" ["countryCode"]=&gt; string(2) "UG" } [77]=&gt; array(2) { ["country"]=&gt; string(12) "South Africa" ["countryCode"]=&gt; string(2) "ZA" } [78]=&gt; array(2) { ["country"]=&gt; string(7) "Myanmar" ["countryCode"]=&gt; string(2) "MM" } [79]=&gt; array(2) { ["country"]=&gt; string(9) "Australia" ["countryCode"]=&gt; string(2) "AU" } [80]=&gt; array(2) { ["country"]=&gt; string(4) "Fiji" ["countryCode"]=&gt; string(2) "FJ" } [81]=&gt; array(2) { ["country"]=&gt; string(5) "Italy" ["countryCode"]=&gt; string(2) "IT" } [82]=&gt; array(2) { ["country"]=&gt; string(7) "Andorra" ["countryCode"]=&gt; string(2) "AD" } [83]=&gt; array(2) { ["country"]=&gt; string(6) "Norway" ["countryCode"]=&gt; string(2) "NO" } [84]=&gt; array(2) { ["country"]=&gt; string(6) "Brazil" ["countryCode"]=&gt; string(2) "BR" } [85]=&gt; array(2) { ["country"]=&gt; string(7) "Uruguay" ["countryCode"]=&gt; string(2) "UY" } [86]=&gt; array(2) { ["country"]=&gt; string(9) "Guatemala" ["countryCode"]=&gt; string(2) "GT" } [87]=&gt; array(2) { ["country"]=&gt; string(16) "French Polynesia" ["countryCode"]=&gt; string(2) "PF" } [88]=&gt; array(2) { ["country"]=&gt; string(10) "Seychelles" ["countryCode"]=&gt; string(2) "SC" } [89]=&gt; array(2) { ["country"]=&gt; string(8) "Barbados" ["countryCode"]=&gt; string(2) "BB" } [90]=&gt; array(2) { ["country"]=&gt; string(10) "Montenegro" ["countryCode"]=&gt; string(2) "ME" } [91]=&gt; array(2) { ["country"]=&gt; string(4) "Laos" ["countryCode"]=&gt; string(2) "LA" } [92]=&gt; array(2) { ["country"]=&gt; string(12) "Cook Islands" ["countryCode"]=&gt; string(2) "CK" } [93]=&gt; array(2) { ["country"]=&gt; string(14) "Cayman Islands" ["countryCode"]=&gt; string(2) "KY" } [94]=&gt; array(2) { ["country"]=&gt; string(5) "Gabon" ["countryCode"]=&gt; string(2) "GA" } [95]=&gt; array(2) { ["country"]=&gt; string(12) "Saudi Arabia" ["countryCode"]=&gt; string(2) "SA" } [96]=&gt; array(2) { ["country"]=&gt; string(7) "Vietnam" ["countryCode"]=&gt; string(2) "VN" } [97]=&gt; array(2) { ["country"]=&gt; string(11) "Philippines" ["countryCode"]=&gt; string(2) "PH" } [98]=&gt; array(2) { ["country"]=&gt; string(11) "South Korea" ["countryCode"]=&gt; string(2) "KR" } [99]=&gt; array(2) { ["country"]=&gt; string(5) "Japan" ["countryCode"]=&gt; string(2) "JP" } [100]=&gt; array(2) { ["country"]=&gt; string(7) "Vanuatu" ["countryCode"]=&gt; string(2) "VU" } [101]=&gt; array(2) { ["country"]=&gt; string(11) "New Zealand" ["countryCode"]=&gt; string(2) "NZ" } [102]=&gt; array(2) { ["country"]=&gt; string(7) "Tunisia" ["countryCode"]=&gt; string(2) "TN" } [103]=&gt; array(2) { ["country"]=&gt; string(7) "Ireland" ["countryCode"]=&gt; string(2) "IE" } [104]=&gt; array(2) { ["country"]=&gt; string(8) "Slovenia" ["countryCode"]=&gt; string(2) "SI" } [105]=&gt; array(2) { ["country"]=&gt; string(8) "Suriname" ["countryCode"]=&gt; string(2) "SR" } [106]=&gt; array(2) { ["country"]=&gt; string(7) "Finland" ["countryCode"]=&gt; string(2) "FI" } [107]=&gt; array(2) { ["country"]=&gt; string(5) "Aruba" ["countryCode"]=&gt; string(2) "AW" } [108]=&gt; array(2) { ["country"]=&gt; string(5) "Nepal" ["countryCode"]=&gt; string(2) "NP" } [109]=&gt; array(2) { ["country"]=&gt; string(13) "Faroe Islands" ["countryCode"]=&gt; string(2) "FO" } [110]=&gt; array(2) { ["country"]=&gt; string(5) "Sudan" ["countryCode"]=&gt; string(2) "SD" } [111]=&gt; array(2) { ["country"]=&gt; string(9) "Indonesia" ["countryCode"]=&gt; string(2) "ID" } [112]=&gt; array(2) { ["country"]=&gt; string(5) "China" ["countryCode"]=&gt; string(2) "CN" } [113]=&gt; array(2) { ["country"]=&gt; string(8) "Maldives" ["countryCode"]=&gt; string(2) "MV" } [114]=&gt; array(2) { ["country"]=&gt; string(10) "Uzbekistan" ["countryCode"]=&gt; string(2) "UZ" } [115]=&gt; array(2) { ["country"]=&gt; string(9) "Hong Kong" ["countryCode"]=&gt; string(2) "HK" } [116]=&gt; array(2) { ["country"]=&gt; string(7) "Algeria" ["countryCode"]=&gt; string(2) "DZ" } [117]=&gt; array(2) { ["country"]=&gt; string(7) "Germany" ["countryCode"]=&gt; string(2) "DE" } [118]=&gt; array(2) { ["country"]=&gt; string(4) "Oman" ["countryCode"]=&gt; string(2) "OM" } [119]=&gt; array(2) { ["country"]=&gt; string(6) "France" ["countryCode"]=&gt; string(2) "FR" } [120]=&gt; array(2) { ["country"]=&gt; string(8) "Slovakia" ["countryCode"]=&gt; string(2) "SK" } [121]=&gt; array(2) { ["country"]=&gt; string(6) "Poland" ["countryCode"]=&gt; string(2) "PL" } [122]=&gt; array(2) { ["country"]=&gt; string(7) "Bahamas" ["countryCode"]=&gt; string(2) "BS" } [123]=&gt; array(2) { ["country"]=&gt; string(10) "Guadeloupe" ["countryCode"]=&gt; string(2) "GP" } [124]=&gt; array(2) { ["country"]=&gt; string(8) "Colombia" ["countryCode"]=&gt; string(2) "CO" } [125]=&gt; array(2) { ["country"]=&gt; string(7) "Bolivia" ["countryCode"]=&gt; string(2) "BO" } [126]=&gt; array(2) { ["country"]=&gt; string(7) "Ukraine" ["countryCode"]=&gt; string(2) "UA" } [127]=&gt; array(2) { ["country"]=&gt; string(20) "Netherlands Antilles" ["countryCode"]=&gt; string(2) "AN" } [128]=&gt; array(2) { ["country"]=&gt; string(5) "Tonga" ["countryCode"]=&gt; string(2) "TO" } [129]=&gt; array(2) { ["country"]=&gt; string(7) "Georgia" ["countryCode"]=&gt; string(2) "GE" } [130]=&gt; array(2) { ["country"]=&gt; string(8) "Ethiopia" ["countryCode"]=&gt; string(2) "ET" } [131]=&gt; array(2) { ["country"]=&gt; string(7) "Bermuda" ["countryCode"]=&gt; string(2) "BM" } [132]=&gt; array(2) { ["country"]=&gt; string(6) "Cyprus" ["countryCode"]=&gt; string(2) "CY" } [133]=&gt; array(2) { ["country"]=&gt; string(6) "Gambia" ["countryCode"]=&gt; string(2) "GM" } [134]=&gt; array(2) { ["country"]=&gt; string(7) "Morocco" ["countryCode"]=&gt; string(2) "MA" } [135]=&gt; array(2) { ["country"]=&gt; string(7) "Hungary" ["countryCode"]=&gt; string(2) "HU" } [136]=&gt; array(2) { ["country"]=&gt; string(8) "Honduras" ["countryCode"]=&gt; string(2) "HN" } [137]=&gt; array(2) { ["country"]=&gt; string(4) "Peru" ["countryCode"]=&gt; string(2) "PE" } [138]=&gt; array(2) { ["country"]=&gt; string(7) "Romania" ["countryCode"]=&gt; string(2) "RO" } [139]=&gt; array(2) { ["country"]=&gt; string(7) "Armenia" ["countryCode"]=&gt; string(2) "AM" } [140]=&gt; array(2) { ["country"]=&gt; string(13) "New Caledonia" ["countryCode"]=&gt; string(2) "NC" } [141]=&gt; array(2) { ["country"]=&gt; string(6) "Zambia" ["countryCode"]=&gt; string(2) "ZM" } [142]=&gt; array(2) { ["country"]=&gt; string(5) "India" ["countryCode"]=&gt; string(2) "IN" } [143]=&gt; array(2) { ["country"]=&gt; string(8) "Tanzania" ["countryCode"]=&gt; string(2) "TZ" } [144]=&gt; array(2) { ["country"]=&gt; string(11) "Netherlands" ["countryCode"]=&gt; string(2) "NL" } [145]=&gt; array(2) { ["country"]=&gt; string(7) "Belgium" ["countryCode"]=&gt; string(2) "BE" } [146]=&gt; array(2) { ["country"]=&gt; string(6) "Turkey" ["countryCode"]=&gt; string(2) "TR" } [147]=&gt; array(2) { ["country"]=&gt; string(7) "Namibia" ["countryCode"]=&gt; string(2) "NA" } [148]=&gt; array(2) { ["country"]=&gt; string(7) "Grenada" ["countryCode"]=&gt; string(2) "GD" } [149]=&gt; array(2) { ["country"]=&gt; string(5) "Qatar" ["countryCode"]=&gt; string(2) "QA" } [150]=&gt; array(2) { ["country"]=&gt; string(7) "Iceland" ["countryCode"]=&gt; string(2) "IS" } [151]=&gt; array(2) { ["country"]=&gt; string(7) "Bahrain" ["countryCode"]=&gt; string(2) "BH" } [152]=&gt; array(2) { ["country"]=&gt; string(8) "Zimbabwe" ["countryCode"]=&gt; string(2) "ZW" } [153]=&gt; array(2) { ["country"]=&gt; string(9) "Gibraltar" ["countryCode"]=&gt; string(2) "GI" } [154]=&gt; array(2) { ["country"]=&gt; string(8) "Cameroon" ["countryCode"]=&gt; string(2) "CM" } } </code></pre> <p>then this is the code used to convert to an array and insert into mysql but it doesn't get the data into mysql:</p> <pre><code>$ch = curl_init(); $timeout = 0; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $rawdatar = curl_exec($ch); curl_close($ch); $object_array = json_decode($rawdatar,true); foreach($object_array as $obj) { $country = $obj['country']; $countryCode = $obj['countryCode']; if($countryCode){ $sql = "INSERT INTO `pt_country` (country,countrycode) VALUES ('$country','$countryCode')"; database_queryModify($sql,$result); } else{ echo "dint work"; } } </code></pre> <p>it behaves as if it should be doing somthing but when i check the sql table theres nothing what am i doing wrong with this? i know everything works upto the foreach and im only running this script once to get the data its not a regular request that someone could exploit i will be monitoring the data input</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload