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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:12:47+00:00 2026-06-08T03:12:47+00:00

Could someone please take a look and let me know what i’m doing wrong…

  • 0

Could someone please take a look and let me know what i’m doing wrong…
What i’m trying to acheive is, in the Database i have:

AGENT_REF = 1
AGENT_REF = 2
AGENT_REF = 3
AGENT_REF = 4
AGENT_REF = 5

In a file uploaded that parses information

$blmarArray = array($agentref);

AGENT_REF = 1
AGENT_REF = 2
AGENT_REF = 3
AGENT_REF = 5

What i’d like to happen is to extract the AGENT_REF from the database that ISN’T in the file uploaded, in this case AGENT_REF = 4 so i can DELETE it from mysql.

$sql_archeck = mysql_query("SELECT `AGENT_REF` FROM `eprentals`");
$archeck = mysql_fetch_array($sql_archeck);
$sqlarArray = array($archeck);
$combyArrayDiff = array_diff($blmarArray, $sqlarArray);
print_r ($combyArrayDiff);

All i’m getting is the last or first AGENT REF from the database and not the ones that arn’t present in the db.
(In the db there is 11 but the file uploaded only 8 are present, so i’d like to delete (SHOW) the ones that are in the DB that have been removed from the file uploaded)

Hope you can offer me some guidance into where i’m wrong with this and I Thank you for your time and appriciate your help!

  • 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-08T03:12:50+00:00Added an answer on June 8, 2026 at 3:12 am

    from php manual:

    Returns an array containing all the entries from array1 that are not
    present in any of the other arrays.

    so insted of array_diff($blmarArray, $sqlarArray) you should use array_diff($sqlarArray, $blmarArray)

    = the big array as first parameter, and the samller array as 2nd parameter


    you also need to fetch all rows from the database, not just the first

    $query = "SELECT `AGENT_REF` FROM `eprentals`";
    $resource = mysql_query($query);
    $sqlarArray = array();
    while($row = mysql_fetch_array($sql_archeck))
    {
        $sqlarArray[] = $row['AGENT_REF'];
    }
    $combyArrayDiff = array_diff($sqlarArray, $blmarArray);
    
    /* debug result */
    echo "<p><b>SQL list:</b> " . implode(', ', $sqlarArray) . "</p>";
    echo "<p><b>Uploaded list:</b> " . implode(', ', $blmarArray) . "</p>";
    echo "<p><b>Diff list:</b> " . implode(', ', $combyArrayDiff ) . "</p>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Could someone please tell me what I am doing wrong here. I have compiled
Hi could some one please take a look at this and let me know
Could someone please take a look at this sloppy code and explain to me
Could someone take a look at this code and find out what's wrong with
Could someone please take a look at this ? You'll see the first alert
Could someone please take a few moments out of their schedule to look at
Would someone please take a look at the following code fragments (all from one
Can someone please take a look at the small test case below and tell
Could someone please share the code to take screenshots of web browser control and
I have a mystery object in Javascript - please could someone tell me how

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.