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

  • SEARCH
  • Home
  • 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 844025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:13:26+00:00 2026-05-15T06:13:26+00:00

‘view_act.php’ file <?php $query = mysql_query(‘select * from activities’); $check=mysql_num_rows($query); if($check==0) { echo No

  • 0
'view_act.php' file

<?php


  $query = mysql_query('select * from activities');
   $check=mysql_num_rows($query);
  if($check==0)
   { 
   echo "No enteries found ";
   }

  else
  {  
     static $counter;
     echo '<table border="1" cellpadding="5" cellspacing="5" align="center">

      <tr>

      <th><font color="#FF9900">ACTIVITY NAME</font></th>
      <th><font color="#FF9900">ACTIVITY UPDATE</font></th>
     </tr>';
     while($row=mysql_fetch_array($query))
     { $counter++;


           echo '<tr>';

           echo '<td width=231>
      <form action="update_act.php" method="POST">';

       echo "<center><font color=\"#CC9900\">".$row['act_name']."</center>";


      echo "</td>
      <td width=231>";
      echo "<center>".'<font color="#CCCCCC"><input type="submit" name="edit"                                 value="edit"></center>';
      echo '<input type="hidden" name="act_name'.$counter.'" value="'.$row['act_name'].'" />';
      echo '<input type="hidden" name="count" value="'.$counter.'" />';


      echo "</td>
       </tr>";
     }
     echo "</form>";
    echo "</table>";


  }         

 ?> 


'update_act.php' file

 <?php
      $count=$_POST['count'];
  echo "Old Activity Name : ". $_POST["act_name".$count];
  echo '<br/>Enter new activity name :
       <form action="update_act.php" method="post">
          <input type="text" name="aname">
     <input type="submit" name="submit">'; 
  ?>

Here data fetched from the table has to be updated through a different name of edit button so for each Activity Name a different name is given by counter.But the problem here is when the form is submitted to the page update_act.php the value of last Activity Name is passed every time.So the value of old Activity Name for any row is the last value of the table ‘act_name’.Please help me out to pass corresponding value of counter for any Activity Name.

  • 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-15T06:13:27+00:00Added an answer on May 15, 2026 at 6:13 am

    This is a mess.

    If you want to identify specific rows from a table then that should be done on the primary key or a unique surrogate key. Never, NEVER use a counter/rownum/offset.

    • Not even if you force an ORDER BY (some unique key).

    • Not even if you have a transaction spanning the select and update (which is impossible if they occur on seperate pages anyway)

    C.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I would like to count the length of a string with PHP. The string
I downloaded PostgreSQL from the official website and ran the .dmg installer. After that
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from
I have a reasonable size flat file database of text documents mostly saved in

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.