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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:50:19+00:00 2026-06-09T15:50:19+00:00

I am having some problems with updating a part of my script. I have

  • 0

I am having some problems with updating a part of my script.

I have a webpage wher users can mark checkboxes next to each user they want to ‘recycle’ with another use.

I store the users id in an array like this:

$refsid= explode(',',$_POST['referralIds']); 
$users->_recycleMulti($membershipData['recycle_price'], $userdata['username'], $refsid);

Then, in my _recycleMulti function, I wish to do the actual recycling. Whether it is just one user that have been selected, or 10. Therefore, I am using a for loop.

Yet it still only just updates one user.

My _recycleMulti function looks like this:

function _recycleMulti($value, $username, $referrals_array){


        for($i=0; $i < count($referrals_array); $i++){

            mysql_query("do the update here");

        }
        return "success!"; 

    }  

var_dump($_POST['referralIds']); is returning:

string(3) "4,5" 

This is correct, as I have checked two checkboxes. The ids match the ones in the database.

var_dump($refsid);  is returning:

array(2) { [0]=> string(1) "4" [1]=> string(1) "5" }

What am I doing wrong?

  • 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-09T15:50:21+00:00Added an answer on June 9, 2026 at 3:50 pm

    You could change the for loop to a foreach though it should not make a difference in the execution

    foreach ($referrals_array as $refid) {
        echo "Updating referral ".$refid.".<br>\n";
        // execute SQL code here using $refid value
    }
    

    that might help you see what you’re executing, or if that’s not working well enough, echo your SQL statement and make sure it’s doing what you think it is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some problems building an hierarchistic array structure - I have almost got
I am having some problems updating to the right value. On the page which
I'm having problems updating a mysql database. I want to run this script on
i'm building a webpage for livestreamers from my website. but i'm having some problems
I'm having problems saving/updating rows within a table. I have a method myBean.addRule to
Im having some problems getting capistrano to deploy. As far as i can tell
Currently having some problems- now = datetime.datetime.now() month = now.strftime(%B) site = wikipedia.getSite('en', 'wikiquote')
Im having some problems getting the Sticky Footer to work on my site. If
Im having some problems with a simple toggle in Safari. A really annoying flickering
I am having some problems with the PDF files that I make using the

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.