2015-10-06 84 views
1

我开发了一个小脚本来更新两个表中的一些字段。查询运行时没有错误,但由于任何原因,这些字段上没有任何事情发生。我肯定有些东西被我忽略了,但我不知道是什么。任何想法?在mysql上运行php查询

<?php 
//connection to the database 
$connect=mysql_connect("localhost","xxxxxx","xxxxxxxxx") or 
die("Unable to Connect"); echo ("Connected to server<br>"); 

//select a database to work with 
mysql_select_db("xxxxxxxx") or die("Could not open the db"); echo  ("Connected to database<br>"); 

//execute the SQL query tu update Price taxes on Products 
$sql= "UPDATE pslpn_product SET id_tax_rules_group='68'"; 
$sql= "UPDATE pslpn_product_shop SET id_tax_rules_group='68'"; 
or die ('Could not update data: ' . mysql_error()); 

//close the connection 
echo ("Finalizado<br>") 
?> 

回答

0

如果您忘记添加WHERE子句,它将更新表中的所有行。

UPDATE表名SET字段=值WHERE ID =东西 - 要不然