limit problem when using update.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zorgi
    Recognized Expert Contributor
    • Mar 2008
    • 431

    #16
    I'll try.

    You have in your line 5:

    Code:
    
    .....
    
    while($line = mysql_fetch_assoc($query909)) {
    ....
    Every time that loop happens $line stores one record from your table. $line is an assoc array and I will assume that records id name is Id (this could be different).
    So every iteration you select one record from the table and its id is held in $line['Id']. All you have to do is to store it every time and keep it for later. There is few ways you can do that but I would store it within array like this:

    Code:
    
    
    $ids = array();
    while($line = mysql_fetch_assoc($query909)) {
    
    $ids[] = $line['Id'];
    
    ......
    }
    Once the looping is over $ids holds all id's you need to check. To use them in your WHERE clause you can implode array like this:
    Code:
    $ids_str = implode(",", $ids);
    finally your sql update would look something like this.
    Code:
    UPDATE ........whatever you need to update ........ WHERE Id IN ($ids_str)
    I hope this helps. Good luck.

    Comment

    • canabatz
      New Member
      • Oct 2008
      • 155

      #17
      thanx alot Zorgi!!!!

      i will try that ,and come back with the solution!!

      thanx!!!!

      Comment

      Working...