Hola!
He cambiado un poco el código y ahora lo tengo así:
Código PHP:
$bdd = "zapateriasmargall";
$conexion = mysql_connect(localhost, myzapateri, margall1) or die(mysql_error());
mysql_select_db($bdd,$conexion) or die(mysql_error());
//Variables
$id_size = 1;
$id_color = 17;
$id_product = 7;
$quantity = 50;
//hacemos JOIN de dos tablas
$attribute_table = "zm_product_attribute INNER JOIN zm_product_attribute_combination USING (id_product_attribute)";
//hacemos un SELECT
$select = "SELECT id_attribute, quantity FROM $attribute_table
WHERE id_attribute IN ('$id_size','$id_color')
AND id_product = '$id_product' GROUP BY id_attribute";
echo '<br>' . $select . '<br>';
$result = "UPDATE $select SET quantity='$quantity'";
echo '<br>' . $result . '<br>' . '<br>';
mysql_query($result,$conexion) or die (mysql_error());
Los resultados de los echo y error son los siguientes:
Código PHP:
SELECT id_attribute, quantity FROM zm_product_attribute INNER JOIN zm_product_attribute_combination USING (id_product_attribute) WHERE id_attribute IN ('1','17') AND id_product = '7' GROUP BY id_attribute
UPDATE SELECT id_attribute, quantity FROM zm_product_attribute INNER JOIN zm_product_attribute_combination USING (id_product_attribute) WHERE id_attribute IN ('1','17') AND id_product = '7' GROUP BY id_attribute SET quantity='50'
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT id_attribute, quantity FROM zm_product_attribute INNER JOIN zm_product_at' at line 1
Que estoy haciendo mal?
El SELECT y UPDATE estan bien escritos no?
Gracias