hi i cannot update a table which has foreign keys on it. in this table, instead of displaying the primary keys of the foreign key, i choose to display their names: this is a simple diagram: Here are my foreign tables:
Ölçü Tablosu:
sId sName
1 1x1
2 2x2
Brand Tablo:
bId bName
1 brand1
2 brand2
Faaliyet alanı Tablo:
sId sName
1 supp1
2 supp2
Yani burada birleştirmek bir deyim kullanarak benim Depo Tablo olduğunu:
pId pName pSize pBrand pSupplier
1 prod1 1x1 brand1 supp1
2 prod2 2x2 brand2 supp2
php ve mysql formda benim düzenleme:
########### EDIT PRODUCT
if(isset($_POST['editproduct'])){
$product_id=$_POST["product_code"];
$product_name=$_POST["product_name"];
$size_name=$_POST["size_name"];
$brand_name=$_POST["brand_name"];
$supplier_name=$_POST["supplier_name"];
$sql = "UPDATE warehouse SET
product_name='$product_name'
,size_id='$size_id'
,brand_id='$brand_id'
,supplier_id='$supplier_id'
WHERE
product_code='$product_code'";
$result=mysql_query($sql,$connection) or die(mysql_error());
header("location: warehouse.php");
} ?>
garip şey i tabloyu düzenlemek ilk denemede bu hata olmamasıdır. ancak ikinci kez, o bana yabancı anahtar kısıtlaması hata ister: (
i i güncelliyorum biri birincil anahtar beri benim güncelleştirme sorgusu çatışan depo tabloda birleştirmek bir deyim kullanmak çünkü ben sadece adını görüntüler bir duygu var.