| 
	
 | 
 Posted by Jerry Stuckle on 06/20/26 11:57 
version2 wrote: 
> Hey Jerry, 
>  
> that doesnt cause any errors, but doesn't update all the fields to show 
> 10,20,30,40 etc it only adds on 15 to the name that i want to add 15 
> onto. 
>  
> could i not be calling it or re-arrange to code. 
>  
> look below 
>  
> if ($_GET["action"] == "moveup") { 
>  
> $muscleName=$_GET['muscleName']; 
> $ID = $_GET["ID"]; 
>  
> $rank = 10; 
>  
> $phase2 = "UPDATE ".DB_PREFIX."".TBL_PREFIX." SET position = position + 
> 15 WHERE ID = $ID;"; 
>  
> mysql_query($phase2); 
>  
> $result1 = mysql_query("SELECT id, position FROM 
> ".DB_PREFIX."".TBL_PREFIX." ORDER BY position"); 
>  
> while ($data = mysql_fetch_array($result1)) { 
> $result2 = mysql_query("UPDATE ".DB_PREFIX."".TBL_PREFIX." SET 
> position=$position WHERE ID = {$data['ID']}"); 
> $rank += 10; 
> } 
>  
> header("Location: index_exercise.php?ID=$muscleName"); 
> exit;						 
>  
> 	} 
>  
 
That's because $position isn't defined.  In fact, your update is  
probably failing (check the value of $result2 - false indicates a failure). 
 
Rather you should be setting position=$rank, or use $position instead of  
$rank throughout your code. 
 
 
--  
================== 
Remove the "x" from my email address 
Jerry Stuckle 
JDS Computer Training Corp. 
jstucklex@attglobal.net 
==================
 
  
Navigation:
[Reply to this message] 
 |