Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7992257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:30:39+00:00 2026-06-04T13:30:39+00:00

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

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:30:40+00:00Added an answer on June 4, 2026 at 1:30 pm

    In your SELECT query, you have to specify tha table to get the * like details.* or products.*, 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 bad DELETE syntax :

    while($row=mysql_fetch_array($query)) {
        $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");
    
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this query in DB2 SELECT * FROM SOMESCHEMA.SOMETABLE WHERE SYSDATE > @A
This query works: item = db.GqlQuery(SELECT * FROM Item WHERE CSIN = 13)[0] although
Take this query: SELECT * FROM MyTable WHERE MyColumn = 'SomeValue' ORDER BY SomeFakeQualifier.MyColumn
Why this query doesn’t working: SELECT name FROM ( SELECT name FROM table1 UNION
I want to do: select column1 from db1.table1 where db1.table1.column2 = db2.table2.column1. In this
I have a specific DB2 query, and I would like to execute this query
This query selects all the unique visitor sessions in a certain date range: select
This query takes ~4 seconds to complete: SELECT DISTINCT resources_resource.id, resources_resource.heading, resources_resource.name, resources_resource.old_name, resources_resource.clean_name,
I've got a query in similar structure to below SELECT blah FROM A, B,
I have this query for a DB2 DB where I need to pull data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.