this is my query
$db2=mysql_connect("localhost","root","");
mysql_select_db("my_requests",$db2);
$query=mysql_query("SELECT * FROM details INNER JOIN product ON details.user_id = product.user_id"); // find the city
$row=mysql_fetch_array($query);// save record
$id=$row['user_id'];
echo "$id";
$query1=mysql_query("DELETE * FROM details WHERE details.user_id=$id");
$query2=mysql_query("DELETE * FROM product WHERE product.user_id=$id");
Here i have two tables products and detail ,user id is the primary key in details and made foreign key in product.
lets suppose i have two entries in the database with user_id =12 and another with user_id=11
1. when i take the innerjoin of two tables and try to display the user_id’s it shows only one user_id 12
2. when i am trying to delete data using the user_id,it does not delete the data from the table.
sorry for the bad english
In your
SELECTquery, you have to specify tha table to get the*likedetails.*orproducts.*, becasue you’re joinning two tables. In your case, it’s the same result.You also need to place
$row=mysql_fetch_array($query);in a loop, to fetch each rows, then, you have a badDELETEsyntax :