Click here to Skip to main content
15,843,498 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi friends,

I want to update a row value after clicking one of the column value.
in PHP.

value coming from database as in webpage

Id  name    status.
1   raj     pending ---> this is a hyperlink button
2   raj     pending
3   raj     pending
4   raj     pending

I want if click on "pending button" then I can run any query by which I can update the result of this row only.

I can use this query that update table name set status="approve" where id=1 but i am not sure that when click on the button it only take that id the value coming from database.

Thanks.
Posted
Updated 23-Aug-12 23:36pm
v4
Comments
Joan M 24-Aug-12 4:38am    
In order to post an image (which CP doesn't allow directly) you need to put it into any internet service like imageshack and then post the link here.
It is not a good idea to post "it is very urgent" here, believe me there's lots of people that don't like that and it can generate wrong answers for you.
In order to add the image link, click on the green link "Improve question" at the bottom of your question and paste it.
Good luck with the answers...

1 solution

Hi,
i find the solution.

Add this to that column

Than create a page with approve.php
then add this code there

PHP
<?php
 include("../dbconfig.php");
     $id=$_REQUEST['apply_id'];
    // echo $id;
$query="update apply_leave set status1='approve' where apply_id='".$id."'";

        if(!mysql_query($query,$con))
        {
        die ("An unexpected error occured while saving the record, Please try again!");}
          else
         {
        // echo "Thank You!" . " -" . "<a href='leave-request.php' style='text-decoration:none;color:#094a9c;'> Return Home</a>";
    /*echo "<script> alert('Successfully Approved !')</script>";*/
        header("Location:http://localhost/Mysql/Intranetportal/admin/leave-request.php");
          }
        ?>


Have fun!!!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900