Jump to content

Search the Community

Showing results for tags 'multiple aray'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. I have two multidimensional arrays as follows: Array 01 for new prices of items: Array ( [42] => Array ( [0] => 110 [1] => 0.00 ) [41] => Array ( [0] => 80 [1] => 70.00 ) [43] => Array ( [0] => 70 [1] => 60 ) [40] => Array ( [0] => 90 [1] => 80 ) ) 1 Array 02 for old prices of items: Array ( [42] => Array ( [sales_price] => 100.00 [our_price] => 0.00 ) [41] => Array ( [sales_price] => 80.00 [our_price] => 0.00 ) ) 1 Array key of both array are item ids (42,41,43,40). Now I need to compare $new and $old arrays to create update and insert queries. If the values in the new array are different from those in the old one, the table should be updated. If there are more elements in the new array than in the old array, they should be identified for the insert query. So basically I want to divide new array into two parts with comparing old array and considering the terms above. Expecting two arrays should be as follows: Array ( [42] => Array ( [0] => 110 [1] => 0.00 ) [41] => Array ( [0] => 80 [1] => 70.00 ) ) 1 Array ( [43] => Array ( [0] => 70 [1] => 60 ) [40] => Array ( [0] => 90 [1] => 80 ) ) 1 The Code I have so far: foreach ($priceNew as $newIds => $newPrices) { foreach($priceOld as $oldIds => $oldPrices) { } }
  2. I have an html form that, via javascript, depending on the user selection, appears some input fields in a row. This is the javascript: function addInputAdult(num){ inputElementsAdult.innerHTML=''; for(xAdult=0;xAdult<num;xAdult++)inputElementsAdult.innerHTML=inputElementsAdult.innerHTML +'<table width="100%" style="margin:0; padding:0;"><tr><th width="24%" scope="col">Adult '+(xAdult + 1)+' - Name</th><th width="13%" scope="col">Birthdate</th><th width="18%" scope="col">Place of Birth</th><th width="13%" scope="col">Passport Nr</th><th width="13%" scope="col">Issue Date</th><th width="16%" scope="col">Expiry Date</th></tr><tr><td> <input name="adlt[][Emri]" type="text" id="adltEmri" style="width:98%;" /></td><td> <input style="width:95%;" type="text" name="adlt[][Dtlindja]" id="adltDtlindja" /></td><td> <input style="width:90%;" type="text" name="adlt[][Vendlindja]" id="adltVendlindja" /></td><td> <input style="width:90%;" type="text" name="adlt[][Pass]" id="adltPass" /></td><td> <input style="width:90%;" type="text" name="adlt[][DtLeshimit]" id="adltDtLeshimit" /></td><td><input style="width:90%;" type="text" name="adlt[][DtSkadimit]" id="adltDtSkadimit" /></td></tr></table>'; } So, the user make the selection and the form appears. Now, i want to add the user input details in my mysql database. Can you help me on this please? I'm not "sure" how to do this. My problem is on getting the informations from the form in a way that those information could be usable and understandable. What i have tried is: foreach ( $_POST['adlt'] as $adult) { $getd=implode(",",$adult); echo $getd; } ...but it shows all the information not separated and I don't know how to separate informations from each other. Output looks like this: adult1 Nameadult1Birthdateadult1Passportadult1PlaceofBirthadult1IssueDateadult1expirydateadult2 Nameadult2 Birthdate...and so on Can you help me on this, please? Thank you in advance
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.