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 7685935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:21:48+00:00 2026-05-31T19:21:48+00:00

I need to delete some data from mysql. I know a bit of php

  • 0

I need to delete some data from mysql. I know a bit of php but get really lost with mysql and really don’t want to mess this up… I did make a .sql backup but I need to get this right. That’s why i’m posting the question here. I know I will get some crap for not trying myself and posting my code here but to be hosnest.. this is as far as I got before I got stuck:

<?php
$con = mysql_connect("localhost","USERNAME","PASSWORD");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("DATABASE", $con);

$result = mysql_query("SELECT * FROM subscriber");

while($row = mysql_fetch_array($result))
  {
  echo $row['mail'] . " " . $row['snid'];
  echo "<br />";
  }

mysql_close($con);
?>

What i’m really trying to do is this:

  • Locate all rows where status = 0 the in the table called subscription and get the field snid (which is an integer)
  • Then go to the table called subscriber and delete the row with the matching snid (also a field in this tables row)
  • Then go back to subscription and delete the original matched row

Does this make sence?…. I’ve done my own head in just trying to explain it ๐Ÿ™

  • 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-05-31T19:21:49+00:00Added an answer on May 31, 2026 at 7:21 pm

    To do what you’ve asked, you only need 1 query:

    delete subscriber, subscription from subscriber,subscription where subscription.status = 0 and subscription.snid=subscriber.snid;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to know either my PHP script could delete some data from data
I need to delete some Unicode symbols from the string 'ุจูุณู’ู…ู ุงู„ู„ู‘ูŽู‡ู ุงู„ุฑู‘ูŽุญู’ู…ูŽูฐู†ู ุงู„ุฑู‘ูŽุญููŠู…ู'
We are using MySQL to get data from database, match the data and send
I need to delete some text files when a certain database is dropped from
I need to delete some rows from csv file based on a column value.
I fetch data in table. but i need to delete it when user click
I am trying to get some data from page to page and then mail
I need to move some data from a table to a archive table. Now
I have 50GB mysql database (80 tables) that I need to delete some contents
I'd like to write some tests for delete() in Grails. These need to be

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.