0

我有 2 张不同的桌子projectpayments. 当我插入付款时,我希望将表中的值flag更改project为与(是表中的另一个单元格) 和 的paid$money inserted完全相同的值。costcostproject$order = proj_name

代码来了!

 <?php
 include("connect.php");
 // define variables
 $name = $_POST['name'];
 $order = $_POST['order'];
 $money = $_POST['money'];
 $date = $_POST['date'];

 $sql="INSERT INTO payments VALUES
 ('','$name','$order','$money','$date')";

 $s="UPDATE project SET flag='payed' WHERE proj_name='$order' AND cost like '%money%'";
 mysql_query($s);
 echo '<center>' ."Payment stored successfully". '</center>';
 echo '<center>'."<a href='payments_edit.php'>View Changes</a>".'</center>';

 if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }

mysql_close();?>

如果您想了解更多信息,请告诉我:)

4

1 回答 1

2

$AND cost like '%money%'. 它应该是AND cost like '%$money%'

于 2012-06-11T09:28:39.777 回答