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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:47:17+00:00 2026-05-16T23:47:17+00:00

My code is here $query = SELECT * FROM `table`; $result = mysql_query($query); $arr

  • 0

My code is here

$query = "SELECT * FROM `table`";
$result = mysql_query($query);
 $arr = array();
 while($info = mysql_fetch_array($result)) {

 if (!in_array($info['row'], $arr)) {
 $arr[] = $info['row'];
 }
 }

foreach ($arr as $v) {
 $pass = "pass";
$query2 = "UPDATE `table` SET pass = '$pass'  WHERE row = '$v'";
$result2 = mysql_query($query2);
}

it processes for 2 minutes and nothing happens in db. where could i be wrong ?

Thanks

EDIT: OK i found my mistake. It was about the code that i wrote for generating random pass which i didnt include in my question. thanks everybody thou

  • 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-16T23:47:17+00:00Added an answer on May 16, 2026 at 11:47 pm

    One possibility is that you’re running out of memory: by storing all of the rows in an array, you’ll need a lot of memory before you even get to the update part – in that case, that fully explains why you see no changes; the script never gets to that part.

    Another possibility is that your script runs for too long and is stopped. Depending on your server configuration, set_time_limit may be an option in that case.

    However, the effect of the script you’re showing us here is the exact same as this single query:

    UPDATE `table` SET pass = 'pass'
    

    since you have no conditions on the rows in the select, and the only filtering you do is to not store multiple rows with the same value in the row column – but when you get to the update pass, you’re identifying each row via the row column, meaning it will update all rows with the same value in the row column. If row values are unique for each row, then there’s no need to check if you’ve already seen the row; if it’s not unique, then you need a different criteria when updating.

    If you run the update directly, PHP will not need to use a ton of memory and MySQL will not have to search for each individual row during the update; it can just iterate through them all in one go. Unless you’re leaving something out here, you’ll be much better off just doing that one simple query.

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

Sidebar

Related Questions

I want to query a result from a table. The problem I run into
Here's my query, it is fairly straightforward: SELECT INVOICE_ITEMS.II_IVNUM, INVOICE_ITEMS.IIQSHP FROM INVOICE_ITEMS LEFT JOIN
I have this code here: var infiltrationResult; while(thisOption) { var trNode = document.createElement('tr'); var
This is what my code does: it gets 4 rows from my table, stores
i'm getting a very strange result from my database query, i was hoping someone
I am using pseudo-code here, but this is in JavaScript. With the most efficient
Edit: The code here still has some bugs in it, and it could do
I've got this code here: SqlCommand CodeStatus = new SqlCommand(SQL, DB); DB.Open(); Reader =
We have some old C code here that's built with nmake. Is there an
I am compiling a legacy C code here and there is a lot of

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.