Note that there are some explanatory texts on larger screens.

plurals
  1. POphp loops and grouping mysql
    primarykey
    data
    text
    <p>I am currently adding a purchase history section to payment system, the system is built in PHP (codeigniter framework) and mysql. The idea of the payment history section is that all the customer purchases are grouped together by date, so in the end the HTML would look similar to this, </p> <p>My question is I can get the data out of the database no problem, but how can i loop through it so that I show the date of the purchases and then purchases relevent to that date and so on and so forth.</p> <p>EDIT - A PRINT OUT OF THE ARRAY THAT IS RETURNED FROM THE DB SORRY FOR THE SIZE</p> <pre><code> Array ( [0] =&gt; Array ( [id] =&gt; [employer_id] =&gt; 1 [cv_id] =&gt; [transaction_id] =&gt; -1402310 [date_created] =&gt; 20-07-10 [date_updated] =&gt; [code] =&gt; 849711492 [status] =&gt; SHOW [is_complete] =&gt; TRUE [job_status] =&gt; 1 [dob] =&gt; [will_relocate] =&gt; Y [education_level] =&gt; HIGH_SCHOOL [job_looking_for] =&gt; [keywords_education] =&gt; Halifax University [keywords_employment] =&gt; senior applications developer [self_description] =&gt; [looking_for] =&gt; Lorem ipsum [sector_id_csv] =&gt; 10,23,14,6,3 [key_skills_csv] =&gt; [expected_salary_level] =&gt; LEVEL_6 [expected_salary_low] =&gt; 0 [expected_salary_high] =&gt; 0 [best_salary_low] =&gt; 0 [best_salary_high] =&gt; 0 [last_job_salary_low] =&gt; [last_job_salary_high] =&gt; [last_job_title_1] =&gt; Designer [last_job_title_2] =&gt; [last_job_employer_1] =&gt; BT [last_job_employer_2] =&gt; [qual_highest_level] =&gt; 0 [is_grad] =&gt; Y [is_contract] =&gt; N [is_temporary] =&gt; Y [is_permanent] =&gt; Y [is_full_time] =&gt; Y [is_part_time] =&gt; Y [logitude] =&gt; [latitude] =&gt; [city] =&gt; [area] =&gt; [sign_up_stages_completed] =&gt; [sign_up_last_stage_completed] =&gt; [sign_up_complete] =&gt; [email_authenticated] =&gt; [email] =&gt; [email_contact] =&gt; [phone_contact_number] =&gt; [password] =&gt; [firstname] =&gt; [surname] =&gt; [address_1] =&gt; [address_2] =&gt; [address_3] =&gt; [postcode] =&gt; [country] =&gt; ) [1] =&gt; Array ( [id] =&gt; [employer_id] =&gt; 1 [cv_id] =&gt; [transaction_id] =&gt; -1402310 [date_created] =&gt; 20-07-10 [date_updated] =&gt; [code] =&gt; 849719383 [status] =&gt; SHOW [is_complete] =&gt; TRUE [job_status] =&gt; 1 [dob] =&gt; [will_relocate] =&gt; Y [education_level] =&gt; HIGH_SCHOOL [job_looking_for] =&gt; [keywords_education] =&gt; Crewe Art School [keywords_employment] =&gt; senior applications developer [self_description] =&gt; [looking_for] =&gt; Lorem ipsum [sector_id_csv] =&gt; 13,24,7,17,5 [key_skills_csv] =&gt; [expected_salary_level] =&gt; LEVEL_6 [expected_salary_low] =&gt; 0 [expected_salary_high] =&gt; 0 [best_salary_low] =&gt; 0 [best_salary_high] =&gt; 0 [last_job_salary_low] =&gt; [last_job_salary_high] =&gt; [last_job_title_1] =&gt; Developer [last_job_title_2] =&gt; [last_job_employer_1] =&gt; Orange [last_job_employer_2] =&gt; [qual_highest_level] =&gt; 0 [is_grad] =&gt; Y [is_contract] =&gt; N [is_temporary] =&gt; Y [is_permanent] =&gt; Y [is_full_time] =&gt; Y [is_part_time] =&gt; N [logitude] =&gt; [latitude] =&gt; [city] =&gt; [area] =&gt; [sign_up_stages_completed] =&gt; [sign_up_last_stage_completed] =&gt; [sign_up_complete] =&gt; [email_authenticated] =&gt; [email] =&gt; [email_contact] =&gt; [phone_contact_number] =&gt; [password] =&gt; [firstname] =&gt; [surname] =&gt; [address_1] =&gt; [address_2] =&gt; [address_3] =&gt; [postcode] =&gt; [country] =&gt; ) [2] =&gt; Array ( [id] =&gt; [employer_id] =&gt; 1 [cv_id] =&gt; [transaction_id] =&gt; 23-9-1402338 [date_created] =&gt; 17-07-10 [date_updated] =&gt; [code] =&gt; 849711492 [status] =&gt; SHOW [is_complete] =&gt; TRUE [job_status] =&gt; 1 [dob] =&gt; [will_relocate] =&gt; Y [education_level] =&gt; HIGH_SCHOOL [job_looking_for] =&gt; [keywords_education] =&gt; Halifax University [keywords_employment] =&gt; senior applications developer [self_description] =&gt; [looking_for] =&gt; Lorem ipsum [sector_id_csv] =&gt; 10,23,14,6,3 [key_skills_csv] =&gt; [expected_salary_level] =&gt; LEVEL_6 [expected_salary_low] =&gt; 0 [expected_salary_high] =&gt; 0 [best_salary_low] =&gt; 0 [best_salary_high] =&gt; 0 [last_job_salary_low] =&gt; [last_job_salary_high] =&gt; [last_job_title_1] =&gt; Designer [last_job_title_2] =&gt; [last_job_employer_1] =&gt; BT [last_job_employer_2] =&gt; [qual_highest_level] =&gt; 0 [is_grad] =&gt; Y [is_contract] =&gt; N [is_temporary] =&gt; Y [is_permanent] =&gt; Y [is_full_time] =&gt; Y [is_part_time] =&gt; Y [logitude] =&gt; [latitude] =&gt; [city] =&gt; [area] =&gt; [sign_up_stages_completed] =&gt; [sign_up_last_stage_completed] =&gt; [sign_up_complete] =&gt; [email_authenticated] =&gt; [email] =&gt; [email_contact] =&gt; [phone_contact_number] =&gt; [password] =&gt; [firstname] =&gt; [surname] =&gt; [address_1] =&gt; [address_2] =&gt; [address_3] =&gt; [postcode] =&gt; [country] =&gt; ) [3] =&gt; Array ( [id] =&gt; [employer_id] =&gt; 1 [cv_id] =&gt; [transaction_id] =&gt; 23-9-1402338 [date_created] =&gt; 17-07-10 [date_updated] =&gt; [code] =&gt; 849719383 [status] =&gt; SHOW [is_complete] =&gt; TRUE [job_status] =&gt; 1 [dob] =&gt; [will_relocate] =&gt; Y [education_level] =&gt; HIGH_SCHOOL [job_looking_for] =&gt; [keywords_education] =&gt; Crewe Art School [keywords_employment] =&gt; senior applications developer [self_description] =&gt; [looking_for] =&gt; Lorem ipsum [sector_id_csv] =&gt; 13,24,7,17,5 [key_skills_csv] =&gt; [expected_salary_level] =&gt; LEVEL_6 [expected_salary_low] =&gt; 0 [expected_salary_high] =&gt; 0 [best_salary_low] =&gt; 0 [best_salary_high] =&gt; 0 [last_job_salary_low] =&gt; [last_job_salary_high] =&gt; [last_job_title_1] =&gt; Developer [last_job_title_2] =&gt; [last_job_employer_1] =&gt; Orange [last_job_employer_2] =&gt; [qual_highest_level] =&gt; 0 [is_grad] =&gt; Y [is_contract] =&gt; N [is_temporary] =&gt; Y [is_permanent] =&gt; Y [is_full_time] =&gt; Y [is_part_time] =&gt; N [logitude] =&gt; [latitude] =&gt; [city] =&gt; [area] =&gt; [sign_up_stages_completed] =&gt; [sign_up_last_stage_completed] =&gt; [sign_up_complete] =&gt; [email_authenticated] =&gt; [email] =&gt; [email_contact] =&gt; [phone_contact_number] =&gt; [password] =&gt; [firstname] =&gt; [surname] =&gt; [address_1] =&gt; [address_2] =&gt; [address_3] =&gt; [postcode] =&gt; [country] =&gt; ) ) </code></pre> <p>Basically Every Time there is a new data I need to list the contents of the array under it, and if two arrays have the same data list them just under one data something like, </p> <p><strong>30-07-10</strong></p> <p>Result 1<br> 2<br> 3</p> <p><strong>28-7-10</strong></p> <p>4<br> 5</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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