about updating records in MYSQL using PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shehan31
Forum Commoner
Posts: 59
Joined: Sun Aug 29, 2010 5:24 am

about updating records in MYSQL using PHP

Post by shehan31 »

echo "<h2> transaction description </h2>";
echo "<hr>";
//Connection to the data base.
$connect = mysql_connect ("localhost","root","") or die ("error");
mysql_select_db ("guestbook") or die ("eroor connecting Database");

$queryget = mysql_query ("select * from report ORDER BY Transaction_Number DESC LIMIT 5" ) or die (" error with table");

//this while loop will get the information from the data base and it will be displayed on the web interface.
echo "<hr>";
while ( $row = mysql_fetch_assoc ($queryget) ){
$Customername = $row ['Customer_name'];
$Transaction_Number = $row ['Transaction_Number'];
$Price = $row ['Price'];
$Weight = $row ['Weight'];
$date = $row ['Date'];
$time = $row ['Time'];
echo"
<table>
<tr>
<td>
<b> Customer name : $Customername</b>
</td>
</tr>
<tr>
<td>
<b> Weight : $Weight</b>
<p>
<input type='submit' name='submit2' value='Void'>
</td>
</tr>
";

echo "<hr>";
}
// to get the summation of the parameter weight.
$query = "SELECT SUM(Weight) FROM report ";

$result = mysql_query($query) or die(mysql_error());

// Print out result
while($row = mysql_fetch_array($result)){
echo "Total ". $row['SUM(Weight)'];
echo "<br />";
}

// this will post the input data into the data base.
if (isset($_POST['submit1']))
{

$Customername = $_POST['Customer_name'];
$Transaction_Number = $_POST['Transaction_Number'];
$Price = $_POST['Price'];
$Weight = $_POST['Weight'];
$date = date("Y-m-d");
$time = date("H:i:s");
$status = 'Completed'; // this is to indicate that the transaction has done.


if ($Customername&&$Transaction_Number&&$Price&&$Weight )
{
$querypost = mysql_query (" INSERT INTO report VALUES ('$Customername', '$Transaction_Number', '$Price', '$Weight','$date','$time','$status')");

echo "Please wait... <meta http-equiv='refresh' content='4'>";
}
else
echo " fill out all fileds";
}

// when the operator clicked the void button on the web interface,that perticular transaction has to be marked as cancel.this part is not working for it.

if (isset($POST['submit2']))
{
$querypost = mysql_query ("UPDATE report SET
Status = 'Cancel'
WHERE
Customer name = '???', Transaction_Number = '???',Price = '???', Date = '???', Time = '???'AND Weight = '???'");
}

else
echo " Updating process is not sucessfull";



echo"
<form action='guestbook.php' method='POST'>
<table width= '100 %'>
<tr>
<td>
Customer name
</td>
<td>
<input type='text' name='Customer_name' maxlength='30'>
</td>
</tr>
<tr>
<td>
Transaction Number
</td>
<td>
<input type='int' name='Transaction_Number' maxlength='25'>
</td>
</tr>
<tr>
<td>
Price
</td>
<td>
<input type='int' name='Price' maxlength='25'>
</td>
</tr>
<tr>
<td valign='top'>
Weight
<td>
<input type='int' name='Weight' maxlength='25'>

<p>
<input type='submit' name='submit1' value='Confirm'>
</td>
</tr>
</table>

</form>
"
?>


Hi;
I am trying to create a system for business transactions. if some one enters a new transaction through the web interface, it will save in the data base and als it will be marked as completed. If some one wants to void (cancel) a past transaction, the perosn who is invloved in sales have to click the void button.
then the data base will be updated the completed staus in to cancel. no changes will be done for the other parameters such as customer name, date, weight etc.. That is my requirment. unfortunateley my updating part is not working for the void button. The idea of this change is to split the canceld and completed transaction in to two for the report.
my friends asked me to use a check box but i realized the actions is almost same like this. I felt like i am missing a logic to select a perticular transaction from the web.
Does any one have a better solution for this.
Thank you.
Please refer to my attachments.
Shehan Fernando :?:
Attachments
web interface
web interface
Untitled2.jpg (98.79 KiB) Viewed 1862 times
data base
data base
Untitled.jpg (152.09 KiB) Viewed 1862 times
Jsphlane20
Forum Newbie
Posts: 17
Joined: Wed Aug 11, 2010 1:17 pm
Contact:

Re: about updating records in MYSQL using PHP

Post by Jsphlane20 »

Shehan31,

I think I have an understanding of what you are trying to accomplish. If the operator selects the void button you would like to update that record with the status of “Canceled”. I think there are several ways to accomplish this. One way you can do this is by first adding an extra field in your 'report' table named “id” and set it to auto-increment. That will give every record in your customer database a unique id upon creation. If you are now familiar with how this works, please search for tutorials on youtube.

You could then do something similar.

-----------------------INFO THAT IS DISPLAYED

<

Code: Select all

?php

echo "<h2> transaction description </h2>";
echo "<hr>";
//Connection to the data base.
$connect = mysql_connect ("localhost","root","") or die ("error");
mysql_select_db ("guestbook") or die ("eroor connecting Database");

$queryget = mysql_query ("select * from report ORDER BY Transaction_Number DESC LIMIT 5" ) or die (" error with table");

//this while loop will get the information from the data base and it will be displayed on the web interface.
echo "<hr>"; 
while ( $row = mysql_fetch_assoc ($queryget) ){
$id = $row['id']; //puls in the unique id for this customer.
$Customername = $row ['Customer_name'];
$Transaction_Number = $row ['Transaction_Number'];
$Price = $row ['Price'];
$Weight = $row ['Weight'];
$date = $row ['Date'];
$time = $row ['Time'];
echo"
<table>
<tr>
<td> 
<b> Customer name : $Customername</b>
</td>
</tr>	
<tr>
<td> 
<b> Weight : $Weight</b>
<p>
<input type='hidden' name='id' value='$id'>
<input type='submit' name='submit2' value='Void'>
</td>
</tr>
";
?>

-----------------------CODE TO UPDATE THE RECORD

Code: Select all

<?php

if (isset($_POST['submit2']))
{
  if(isset($_POST['id']) 
  {
    $id = $_POST['id'];
  }
  $query = "UPDATE report SET Status = 'Cancel' WHERE id = '$id';";
  mysql_query($query) or die('Updating process is not sucessfull');
} 

?>
I haven't tested this exact code but you should be able to adjust as necessary. Please reply confirming your understanding.
shehan31
Forum Commoner
Posts: 59
Joined: Sun Aug 29, 2010 5:24 am

Re: about updating records in MYSQL using PHP

Post by shehan31 »

hi jsphlane20;
First of all thank you very much for spending some time to help me.I have tried what you have sent. but its not working. its not updating. when i used this code, i cannot enter values into the data base too.
<?php

echo "<h2> transaction description </h2>";
echo "<hr>";
//Connection to the data base.
$connect = mysql_connect ("localhost","root","") or die ("error");
mysql_select_db ("guestbook") or die ("eroor connecting Database");

$queryget = mysql_query ("select * from report ORDER BY Transaction_Number DESC LIMIT 5" ) or die (" error with table");

//this while loop will get the information from the data base and it will be displayed on the web interface.
echo "<hr>";
while ( $row = mysql_fetch_assoc ($queryget) ){
$id = $row['id'];
$Customername = $row ['Customer_name'];
$Transaction_Number = $row ['Transaction_Number'];
$Price = $row ['Price'];
$Weight = $row ['Weight'];
$date = $row ['Date'];
$time = $row ['Time'];
echo"
<table>
<tr>
<td>
<b> Customer name : $Customername</b>
</td>
</tr>
<tr>
<td>
<b> Weight : $Weight</b>
<p>
<input type='hidden' name='id' value='$id'>
<input type='submit' name='submit2' value='Void'>
</td>
</tr>
";

echo "<hr>";
}
// to get the summation of the parameter weight.
$query = "SELECT SUM(Weight) FROM report ";

$result = mysql_query($query) or die(mysql_error());

// Print out result
while($row = mysql_fetch_array($result)){
echo "Total ". $row['SUM(Weight)'];
echo "<br />";
}

// this will post the input data into the data base.
if (isset($_POST['submit1']))
{

$Customername = $_POST['Customer_name'];
$Transaction_Number = $_POST['Transaction_Number'];
$Price = $_POST['Price'];
$Weight = $_POST['Weight'];
$date = date("Y-m-d");
$time = date("H:i:s");
$status = 'Completed'; // this is to indicate that the transaction has done.


if ($Customername&&$Transaction_Number&&$Price&&$Weight )
{
$querypost = mysql_query (" INSERT INTO report VALUES ('',$Customername', '$Transaction_Number', '$Price', '$Weight','$date','$time','$status')");

echo "Please wait... <meta http-equiv='refresh' content='4'>";
}
else
echo " fill out all fileds";
}

// when the operator clicked the void button on the web interface,that perticular transaction has to be marked as cancel.this part is not working for it.

if (isset($POST['submit2']))
{

if(isset($_POST['id']))
{
$id = $_POST['id'];
}


$query = "UPDATE report SET Status = 'Cancel' WHERE id = $row ['id']";
mysql_query($query) or die('Updating process is not sucessfull');

}








echo"
<form action='guestbook.php' method='POST'>
<table width= '100 %'>
<tr>
<td>
Customer name
</td>
<td>
<input type='text' name='Customer_name' maxlength='30'>
</td>
</tr>
<tr>
<td>
Transaction Number
</td>
<td>
<input type='int' name='Transaction_Number' maxlength='25'>
</td>
</tr>
<tr>
<td>
Price
</td>
<td>
<input type='int' name='Price' maxlength='25'>
</td>
</tr>
<tr>
<td valign='top'>
Weight
<td>
<input type='int' name='Weight' maxlength='25'>

<p>
<input type='submit' name='submit1' value='Confirm'>
</td>
</tr>
</table>

</form>
"
?>


Jsphlane20 wrote:Shehan31,

I think I have an understanding of what you are trying to accomplish. If the operator selects the void button you would like to update that record with the status of “Canceled”. I think there are several ways to accomplish this. One way you can do this is by first adding an extra field in your 'report' table named “id” and set it to auto-increment. That will give every record in your customer database a unique id upon creation. If you are now familiar with how this works, please search for tutorials on youtube.

You could then do something similar.

-----------------------INFO THAT IS DISPLAYED

<

Code: Select all

?php

echo "<h2> transaction description </h2>";
echo "<hr>";
//Connection to the data base.
$connect = mysql_connect ("localhost","root","") or die ("error");
mysql_select_db ("guestbook") or die ("eroor connecting Database");

$queryget = mysql_query ("select * from report ORDER BY Transaction_Number DESC LIMIT 5" ) or die (" error with table");

//this while loop will get the information from the data base and it will be displayed on the web interface.
echo "<hr>"; 
while ( $row = mysql_fetch_assoc ($queryget) ){
$id = $row['id']; //puls in the unique id for this customer.
$Customername = $row ['Customer_name'];
$Transaction_Number = $row ['Transaction_Number'];
$Price = $row ['Price'];
$Weight = $row ['Weight'];
$date = $row ['Date'];
$time = $row ['Time'];
echo"
<table>
<tr>
<td> 
<b> Customer name : $Customername</b>
</td>
</tr>	
<tr>
<td> 
<b> Weight : $Weight</b>
<p>
<input type='hidden' name='id' value='$id'>
<input type='submit' name='submit2' value='Void'>
</td>
</tr>
";
?>

-----------------------CODE TO UPDATE THE RECORD

Code: Select all

<?php

if (isset($_POST['submit2']))
{
  if(isset($_POST['id']) 
  {
    $id = $_POST['id'];
  }
  $query = "UPDATE report SET Status = 'Cancel' WHERE id = '$id';";
  mysql_query($query) or die('Updating process is not sucessfull');
} 

?>
I haven't tested this exact code but you should be able to adjust as necessary. Please reply confirming your understanding.

hi jasphlane 20;
it does not work with and the status will not be changed. when i use this code i cant enter values in to the data base by the web interface.
<?php

echo "<h2> transaction description </h2>";
echo "<hr>";
//Connection to the data base.
$connect = mysql_connect ("localhost","root","") or die ("error");
mysql_select_db ("guestbook") or die ("eroor connecting Database");

$queryget = mysql_query ("select * from report ORDER BY Transaction_Number DESC LIMIT 5" ) or die (" error with table");

//this while loop will get the information from the data base and it will be displayed on the web interface.
echo "<hr>";
while ( $row = mysql_fetch_assoc ($queryget) ){
$id = $row['id'];
$Customername = $row ['Customer_name'];
$Transaction_Number = $row ['Transaction_Number'];
$Price = $row ['Price'];
$Weight = $row ['Weight'];
$date = $row ['Date'];
$time = $row ['Time'];
echo"
<table>
<tr>
<td>
<b> Customer name : $Customername</b>
</td>
</tr>
<tr>
<td>
<b> Weight : $Weight</b>
<p>
<input type='hidden' name='id' value='$id'>
<input type='submit' name='submit2' value='Void'>
</td>
</tr>
";

echo "<hr>";
}
// to get the summation of the parameter weight.
$query = "SELECT SUM(Weight) FROM report ";

$result = mysql_query($query) or die(mysql_error());

// Print out result
while($row = mysql_fetch_array($result)){
echo "Total ". $row['SUM(Weight)'];
echo "<br />";
}

// this will post the input data into the data base.
if (isset($_POST['submit1']))
{

$Customername = $_POST['Customer_name'];
$Transaction_Number = $_POST['Transaction_Number'];
$Price = $_POST['Price'];
$Weight = $_POST['Weight'];
$date = date("Y-m-d");
$time = date("H:i:s");
$status = 'Completed'; // this is to indicate that the transaction has done.


if ($Customername&&$Transaction_Number&&$Price&&$Weight )
{
$querypost = mysql_query (" INSERT INTO report VALUES ('',$Customername', '$Transaction_Number', '$Price', '$Weight','$date','$time','$status')");

echo "Please wait... <meta http-equiv='refresh' content='4'>";
}
else
echo " fill out all fileds";
}

// when the operator clicked the void button on the web interface,that perticular transaction has to be marked as cancel.this part is not working for it.

if (isset($POST['submit2']))
{

if(isset($_POST['id']))
{
$id = $_POST['id'];
}


$query = "UPDATE report SET Status = 'Cancel' WHERE id = $row ['id']";
mysql_query($query) or die('Updating process is not sucessfull');

}
Jsphlane20 wrote:Shehan31,

I think I have an understanding of what you are trying to accomplish. If the operator selects the void button you would like to update that record with the status of “Canceled”. I think there are several ways to accomplish this. One way you can do this is by first adding an extra field in your 'report' table named “id” and set it to auto-increment. That will give every record in your customer database a unique id upon creation. If you are now familiar with how this works, please search for tutorials on youtube.

You could then do something similar.

-----------------------INFO THAT IS DISPLAYED

<

Code: Select all

?php

echo "<h2> transaction description </h2>";
echo "<hr>";
//Connection to the data base.
$connect = mysql_connect ("localhost","root","") or die ("error");
mysql_select_db ("guestbook") or die ("eroor connecting Database");

$queryget = mysql_query ("select * from report ORDER BY Transaction_Number DESC LIMIT 5" ) or die (" error with table");

//this while loop will get the information from the data base and it will be displayed on the web interface.
echo "<hr>"; 
while ( $row = mysql_fetch_assoc ($queryget) ){
$id = $row['id']; //puls in the unique id for this customer.
$Customername = $row ['Customer_name'];
$Transaction_Number = $row ['Transaction_Number'];
$Price = $row ['Price'];
$Weight = $row ['Weight'];
$date = $row ['Date'];
$time = $row ['Time'];
echo"
<table>
<tr>
<td> 
<b> Customer name : $Customername</b>
</td>
</tr>	
<tr>
<td> 
<b> Weight : $Weight</b>
<p>
<input type='hidden' name='id' value='$id'>
<input type='submit' name='submit2' value='Void'>
</td>
</tr>
";
?>

-----------------------CODE TO UPDATE THE RECORD

Code: Select all

<?php

if (isset($_POST['submit2']))
{
  if(isset($_POST['id']) 
  {
    $id = $_POST['id'];
  }
  $query = "UPDATE report SET Status = 'Cancel' WHERE id = '$id';";
  mysql_query($query) or die('Updating process is not sucessfull');
} 

?>
I haven't tested this exact code but you should be able to adjust as necessary. Please reply confirming your understanding.





echo"
<form action='guestbook.php' method='POST'>
<table width= '100 %'>
<tr>
<td>
Customer name
</td>
<td>
<input type='text' name='Customer_name' maxlength='30'>
</td>
</tr>
<tr>
<td>
Transaction Number
</td>
<td>
<input type='int' name='Transaction_Number' maxlength='25'>
</td>
</tr>
<tr>
<td>
Price
</td>
<td>
<input type='int' name='Price' maxlength='25'>
</td>
</tr>
<tr>
<td valign='top'>
Weight
<td>
<input type='int' name='Weight' maxlength='25'>

<p>
<input type='submit' name='submit1' value='Confirm'>
</td>
</tr>
</table>

</form>
"
?>
Jsphlane20
Forum Newbie
Posts: 17
Joined: Wed Aug 11, 2010 1:17 pm
Contact:

Re: about updating records in MYSQL using PHP

Post by Jsphlane20 »

Did you implement the new field into your 'report' table ? Also are you receiving any errors. Every bit of information helps.
shehan31
Forum Commoner
Posts: 59
Joined: Sun Aug 29, 2010 5:24 am

Re: about updating records in MYSQL using PHP

Post by shehan31 »

Jsphlane20 wrote:Did you implement the new field into your 'report' table ? Also are you receiving any errors. Every bit of information helps.
hi jsphlane20;
Thank you for your valuable support.
it does not give any errors. yes ! I have already implemented in the table. Attachments will confirm that.
I suspect the second if statement for submit2 is causing all these problems as before. Now I cannot enter values in to the data base. but there are no errors even if I try to enter values.
Thanking you
Shehan Fernando
shehan31
Forum Commoner
Posts: 59
Joined: Sun Aug 29, 2010 5:24 am

Re: about updating records in MYSQL using PHP

Post by shehan31 »

Jsphlane20 wrote:Did you implement the new field into your 'report' table ? Also are you receiving any errors. Every bit of information helps.
hi jsphlane20;
Thank you for your valuable support.
it does not give any errors. yes ! I have already implemented in the table. Attachments will confirm that.
I suspect the second if statement for submit2 is causing all these problems as before. Now I cannot enter values in to the data base. but there are no errors even if I try to enter values.
Thanking you
Shehan Fernando :(
Attachments
Untitled1.jpg
Untitled1.jpg (87.99 KiB) Viewed 1828 times
Untitled.jpg
Untitled.jpg (137.16 KiB) Viewed 1828 times
Jsphlane20
Forum Newbie
Posts: 17
Joined: Wed Aug 11, 2010 1:17 pm
Contact:

Re: about updating records in MYSQL using PHP

Post by Jsphlane20 »

I recommend you visit http://www.w3schools.com/php/default.asp to catch up on basic php. You are using $POST[''] instead of $_POST['']. This may not be the problem but small things like this can cause your program to work. Also it is important to make sure you have errors turned on in your php.ini file. Some settings have this option turned off by default.
shehan31
Forum Commoner
Posts: 59
Joined: Sun Aug 29, 2010 5:24 am

Re: about updating records in MYSQL using PHP

Post by shehan31 »

Jsphlane20 wrote:I recommend you visit http://www.w3schools.com/php/default.asp to catch up on basic php. You are using $POST[''] instead of $_POST['']. This may not be the problem but small things like this can cause your program to work. Also it is important to make sure you have errors turned on in your php.ini file. Some settings have this option turned off by default.
hi jsphlane20;
thankyou for your reply. after a long thinking i have mangaed to achive some thing aroud the 25% mark. I think this is a good begining for the problem.now the five transactions are displayed. what ever void button I clicked on, the last trannsaction will be marked as cancel. Others will not appear as cancel even i clicked the void button. I have used the get method and a different form.
checkout my code.



<?php include("C:\wamp\www\guestbook\password_protect.php");?>
<html>
<a href="http://127.0.0.1/guestbook.php/?logout=1">Logout</a>
</html>

<?php

echo "<h2> transaction description </h2>";
echo "<hr>";
//Connection to the data base.
$connect = mysql_connect ("localhost","root","") or die ("error");
mysql_select_db ("guestbook") or die ("eroor connecting Database");

$queryget = mysql_query ("select * from report ORDER BY Transaction_Number DESC LIMIT 5" ) or die (" error with table");


//this while loop will get the information from the data base and it will be displayed on the web interface.
echo "<hr>";
while ( $row = mysql_fetch_assoc ($queryget) ){
$id = $row['id'];
$Customername = $row ['Customer_name'];
$Transaction_Number = $row ['Transaction_Number'];
$Price = $row ['Price'];
$Weight = $row ['Weight'];
$date = $row ['Date'];
$time = $row ['Time'];
echo"
<form action='guestbook.php' method='GET'>
<table><blockquote></blockquote>
<tr>
<td>
<b> Customer name : $Customername</b>
</td>
</tr>
<tr>
<td>
<b> Weight : $Weight</b>
<p>
<input type='hidden' name='id' value='$id'>
<input type='submit' name='submit2' value='Void'>
</td>
</tr>
</form>
";

echo "<hr>";
}
// to get the summation of the parameter weight.
$query = "SELECT SUM(Weight) FROM report ";

$result = mysql_query($query) or die(mysql_error());

// Print out result
while($row = mysql_fetch_array($result)){
echo "Total ". $row['SUM(Weight)'];
echo "<br />";
}

// this will post the input data into the data base.
if (isset($_POST['submit1']))
{

$Customername = $_POST['Customer_name'];
$Transaction_Number = $_POST['Transaction_Number'];
$Price = $_POST['Price'];
$Weight = $_POST['Weight'];
$date = date("Y-m-d");
$time = date("H:i:s");
$status = 'Completed'; // this is to indicate that the transaction has done.


if ($Customername&&$Transaction_Number&&$Price&&$Weight )
{
$querypost = mysql_query (" INSERT INTO report VALUES ('','$Customername', '$Transaction_Number', '$Price', '$Weight','$date','$time','$status')");

echo "Please wait... <meta http-equiv='refresh' content='4'>";
}
else
echo " fill out all fileds";
}

// when the operator clicked the void button on the web interface,that perticular transaction has to be marked as cancel.this part is not working for it.



if (isset($_POST['submit2']))
$id = $_GET['id'];
{




mysql_query("UPDATE report SET Status = 'Cancel' WHERE $id=id ");
mysql_query($query) or die('Updating process is not sucessfull');

}










echo"
<form action='guestbook.php' method='POST'>
<table width= '100 %'>
<tr>
<td>
Customer name
</td>
<td>
<input type='text' name='Customer_name' maxlength='30'>
</td>
</tr>
<tr>
<td>
Transaction Number
</td>
<td>
<input type='int' name='Transaction_Number' maxlength='25'>
</td>
</tr>
<tr>
<td>
Price
</td>
<td>
<input type='int' name='Price' maxlength='25'>
</td>
</tr>
<tr>
<td valign='top'>
Weight
<td>
<input type='int' name='Weight' maxlength='25'>

<p>
<input type='submit' name='submit1' value='Confirm'>
</td>
</tr>
</table>

</form>
"
?>

thanking you
Attachments
Untitled.jpg
Untitled.jpg (151.81 KiB) Viewed 1809 times
Jsphlane20
Forum Newbie
Posts: 17
Joined: Wed Aug 11, 2010 1:17 pm
Contact:

Re: about updating records in MYSQL using PHP

Post by Jsphlane20 »

Code: Select all

if (isset($_POST['submit2']))
$id = $_GET['id'];
{

mysql_query("UPDATE report SET Status = 'Cancel' WHERE $id=id ");
mysql_query($query) or die('Updating process is not sucessfull');

} 
The code above should look like the code below. Also, when you are posting code in forums... please use the 'php code' option.. this will make your code much more readable and you would probably get more people willing to help. Let me know if this works.

Code: Select all


if (isset($_POST['submit2']))
{
$id = $_GET['id'];
mysql_query("UPDATE report SET Status = 'Cancel' WHERE id=$id ");
mysql_query($query) or die('Updating process is not sucessfull');
}

shehan31
Forum Commoner
Posts: 59
Joined: Sun Aug 29, 2010 5:24 am

Re: about updating records in MYSQL using PHP

Post by shehan31 »

Jsphlane20 wrote:

Code: Select all

if (isset($_POST['submit2']))
$id = $_GET['id'];
{

mysql_query("UPDATE report SET Status = 'Cancel' WHERE $id=id ");
mysql_query($query) or die('Updating process is not sucessfull');

} 
The code above should look like the code below. Also, when you are posting code in forums... please use the 'php code' option.. this will make your code much more readable and you would probably get more people willing to help. Let me know if this works.

Code: Select all


if (isset($_POST['submit2']))
{
$id = $_GET['id'];
mysql_query("UPDATE report SET Status = 'Cancel' WHERE id=$id ");
mysql_query($query) or die('Updating process is not sucessfull');
}

hi jsphlane
Thank you for your reply.it doesnot work.
Post Reply