Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3855182
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:44:12+00:00 2026-05-19T17:44:12+00:00

I’m a newbie and I’m learning PHP so any help would be greatly appreciated.

  • 0

I’m a newbie and I’m learning PHP so any help would be greatly appreciated.

I’ve been struggling a whole day with this
I have an array that represents user last actions and it just records
day – time – “type of action” (and it’s serialized and sent to mySQL DB.)

And I’m getting array like this:

—- EDITED —-

Array ( [0] => Array ( [Date] => 2011-02-06 [Time] => 06:48 PM [Entry] => Email sent 0 test ) [1] => Array ( [Date] => 2011-02-06 [Time] => 06:48 PM [Entry] => Email sent 1 test ) [2] => Array ( [Date] => 2011-02-06 [Time] => 06:48 PM [Entry] => Email sent 2 test ) ) 

And my question is, I want to add a small button/link in each row (when array is displayed) so that user can remove just that particular action

foreach ( $actionhistory as $row ) {
  foreach ( $row as $key => $value ) {
   echo "foo delete record - $value";
  }
  echo '
'; }

Question:
user now sees this in his browser:

2011-02-0606:48 PM Email sent 0 test
2011-02-0606:48 PM Email sent 1 test
2011-02-0606:48 PME mail sent 2 test

I want to add a link before each date. So when users clicks on that link – external page will be loaded and that particular “record” needs to be removed from the list.

E.G. User wants to remove entry

[2] => Array ( [Date] => 2011-02-06 [Time] => 06:48 PM [Entry] => Email sent 2 test )

he will click on the link beside that entry…. and that’s where I have a problem.
How do I remove that entry but keeping the rest ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T17:44:13+00:00Added an answer on May 19, 2026 at 5:44 pm

    Why all these variables? And your array is wrongly built.

    $actionhistory[] = array(
      "Date" => date("Y-m-d"),
      "Time" => date("h:i A"),
      "Entry" => "Email sent ".$row." test" //This is actually user action
    );
    

    What you want is sending through javascript a particular row of actions’ history to a PHP script, which will delete this row from the database, and maybe also dynamically remove the row from your table. You need to add another element to your array, which is the unique ID in the database, except if you’ve got a unique key with date/time/action – which seems pretty stupid! Then using a JS library such as jQuery, use a simple interaction on a delete button in your row like this:

    <?php
    while ( $data = $query->fetch() ){
      echo '<tr><td....</td>
        <td><input type="button" value="delete" onclick="
          $.post(\'myScript.php?id='.$data['id'].'\',function(d){
            if ( d == 1 ){
              $(this).parents("tr").eq(0).remove();
            }
          });" /></td</tr>';
    }
    ?>
    

    Then myScript.php should take care of $_POST[‘id’], delete the corresponding row, and echo 1 if it was successful, so the row is removed. [Edited, $_POST, not $_GET!]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.