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 5994575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:50:14+00:00 2026-05-22T23:50:14+00:00

When I click the update button it will not update the table but when

  • 0

When I click the update button it will not update the table but when i Click it again it will be updated how can I correct it?

<html>
<head>
<title>pharmacy</title>
<form method="post">
<?php
session_start();
$connection=Mysql_connect('localhost','admin','123');
Mysql_select_db('db',$connection);
$pname=$_SESSION['s1'];
$query="select * from request where ph='$pname'";
if(array_key_exists('rqlist',$_POST))
{
        if(!$connection)
        {
        echo 'connection is invalid';
        }
        else
        {

            $result=mysql_query($query);
            if($result )
            {
            $num=Mysql_num_rows($result);
            $num1=Mysql_num_fields($result);
            echo $num;
                  if($num>0)
                  {
                  echo "<table border=2> Table Request".$_SESSION['s1'];
                   echo"<tr>
                   <td>Id</td><td>Drug</td><td>Quantity</td><td>Doctor</td><td>                           </td><td>pharmacy</td><td>name</td><td>lastname</td><td>Situation</td>
                           </tr>";
        for($i=0;$i<$num;$i++)
        {
        $row=mysql_fetch_row($result);

        echo "<tr>";
        for($j=0;$j<$num1;$j++)
        {
        echo"<td>$row[$j]</td>";    
        }
        echo"<td><input type='Checkbox' name='p[$i]'  value='on' unchecked />     </td>";
        echo"</tr>";
        }
        }
    }
    }//else
    }//array
    if(array_key_exists('update',$_POST)){
            $result=mysql_query($query);
            $qut="select qun from $pname";
            $rt=mysql_query($qut);
            if($result && $rt)
            {
            $num=Mysql_num_rows($result);
            $num1=Mysql_num_fields($result);
            //num2=Mysql_num_rows($rt); 
        if($num>0)
        {
        echo "<table border=2> Table Request".$_SESSION['s1'];
        echo"<tr>
        <td>Id</td><td>Drug</td><td>Quantity</td><td>Doctor</td><td></td><td>pharmacy</td><td></td><td>Situation</td>
        </tr>";
        for($i=0;$i<$num;$i++)
        {
        $row=mysql_fetch_row($result);
        $row2=mysql_fetch_row($rt);
        $dr[$i]=$row[1];
        $qu[$i]=$row[2];
        $st[$i]=$row[7];
        $qun[$i]=$row2[0];
        $query8="select * from $pname where name='$dr[$i]' and qun>$qu[$i] ";
        $result8=mysql_query($query8);
        $num8=Mysql_num_rows($result8);
        if($num8!=0)
        {
          if($row[5]!='ready' && $row[5]!='transfer from $pname')
          {
        $query9="update request set situation='ready' where drug='$dr[$i]' ";
        $qu="update $pname set qun=$qun[$i]-$qu[$i] where name='$dr[$i]' ";
        $result9=mysql_query($query9);
        $resultqu=mysql_query($qu);
        echo $qu;
          }
        }
        else{
        if($row[5]!='ready'&&$row[5]!='transfer from $pname')
          {
        $query10="update request set situation='transfer from $pname' where drug='$dr[$i]' ";
        $result10=mysql_query($query10);
          }
        }
        echo "<tr>";
        for($j=0;$j<$num1;$j++)
        {
        echo"<td>$row[$j]</td>";    
        }
        echo"<td><input type='Checkbox' name='p[$i]'  value='on' unchecked /></td>";
        echo"</tr>";
        }//for$i
        echo"</table>";
        }//if num
        }
        }
?>
<input type="submit" name="rqlist" value="Request list"/>
<input type="submit" name="update" value="Update the list"/>
</form>
</head>
</html>
  • 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-22T23:50:15+00:00Added an answer on May 22, 2026 at 11:50 pm

    Try taking out the request list button to see it if anything changes

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

Sidebar

Related Questions

How to Update a div tag in Master Page using a button click in
I have a button which is in update panel. When I click on button
I have code in an Update Panel and even though on a button click
User click on a link button and it will direct them to a url
I was working with UIs where the user will click the add button to
I have a JavaScript function for a HTML button click event in aspx page
I recently updated my Eclipse (now running 20100218-1602), and I've found whenever I click
Click on this link , you will be redirected to a shopping site. On
I have a table which has one row and only one cell will be
Our software is not ever officially installed on Windows, and currently has an update

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.