So i have this problem were i keep getting the "Fatal error: Unsupported operand types in C:\AppServ\www\elimina_cliente.php on line 35" message, this is the code in the line 35:
LINE 35
while($row = mysql_fetch_array($T_C)+mysql_fetch_array($C_C)+mysql_fetch_array($D_C)){
And this is the rest of the code
PHP CODE
<?php
include("Conectarse.php");
$link=Conectarse();
mysql_query("SET FOREIGN_KEY_CHECKS=0", $link);
$aidi=$_GET['id'];
$T_C=mysql_query("SELECT
cliente.id_cliente, cliente.nombre_cliente, cliente.app_cliente, cliente.apm_cliente, cliente.descripcion_cliente,
telefono_cliente.id_cliente, telefono_cliente.id_telefono,
telefono.id_telefono, telefono.numero_telefono, telefono.descripcion_telefono
FROM cliente
INNER JOIN telefono_cliente ON cliente.id_cliente = telefono_cliente.id_cliente
INNER JOIN telefono ON telefono_cliente.id_telefono = telefono.id_telefono
WHERE cliente.id_cliente = $aidi", $link);
$C_C=mysql_query("SELECT
cliente.id_cliente, cliente.nombre_cliente, cliente.app_cliente, cliente.apm_cliente, cliente.descripcion_cliente,
correo_cliente.id_correo, correo_cliente.id_cliente,
correo.id_correo, correo.email, correo.descripcion_correo
FROM cliente
INNER JOIN correo_cliente ON cliente.id_cliente=correo_cliente.id_correo
INNER JOIN correo ON correo_cliente.id_correo=correo.id_correo
WHERE cliente.id_cliente=$aidi", $link);
$D_C=mysql_query("SELECT
cliente.id_cliente, cliente.nombre_cliente, cliente.app_cliente, cliente.apm_cliente, cliente.descripcion_cliente,
direccion_cliente.id_cliente, direccion_cliente.id_direccion,
direccion.id_direccion, direccion.nombre_calle, direccion.num_int, direccion.num_ext, direccion.descripcion_direccion
FROM cliente
INNER JOIN direccion_cliente ON cliente.id_cliente=direccion_cliente.id_cliente
INNER JOIN direccion ON direccion_cliente.id_direccion=direccion.id_direccion
WHERE cliente.id_cliente=$aidi", $link);
while($row = mysql_fetch_array($T_C)+mysql_fetch_array($C_C)+mysql_fetch_array($D_C)){
if (isset($row)) {
$delete=mysql_query("DELETE FROM cliente WHERE id_cliente='$aidi'", $link);
$deleteTelefono=mysql_query("DELETE FROM telefono WHERE id_telefono='$row[id_telefono]'", $link);
$deleteTelefono_Cliente=mysql_query("DELETE FROM telefono_cliente WHERE id_cliente='$row[id_cliente]' AND id_telefono = '$row[id_telefono]'", $link);
$deleteCorreo=mysql_query("DELETE FROM correo WHERE id_correo='$row[id_correo]'",$link);
$deleteCorreo_Cliente=mysql_query("DELETE FROM correo_cliente WHERE id_cliente='$row[correo]' AND id_correo = '$row[id_correo]'", $link);
$deleteDireccion=mysql_query("DELETE FROM direccion WHERE id_direccion='$row[id_direccion]'",$link);
$deleteDireccion_Cliente=mysql_query("DELETE FROM direccion_cliente WHERE id_cliente='$row[id_direccion]' AND id_direccion = '$row[id_direccion]'", $link);
echo "<script>alert('Eliminación exitosa');</script>";
echo "<script>location.href='clientes.php'</script>";
}
}
?>
My logic on this code is to put the inner joins on variables and then make the variables into arrays and concatenate the arrays so i have to work with only one array, the code worked when i create more clients and then delete them, but when i only have one left i can't delete him and the Fatal Error appears. I really don't know what is my error, help please. And sorry if bad English