Increment record from old record

Hi all,
im writing some php script to add records to my db. However, if a value thats about to be added already exists, then dont add that record.
for example: In my table I have the options for the values of 71,72,73,74,75,76,77 and 78. Each value represents one assignment. If 71 and 72 are already in the db I want to insert only the next one which would be 73. I hope this make sense?

Below I have be able to check and see if they exists and print them out but cannot figure out how add 1(72 +1 =73) to the last number and then insert the new variable it into the db.

I am going crazy and have spend a lot of time on trying to figure this out.

[php]
if ($outcome == successful)
{

	//Update successful week on Parentlogin.com
	$query2=mysql_query("SELECT program_assignments_parts_id, student_id
						 FROM program_assignments_parts_log
						 ORDER BY program_assignments_parts_id DESC") or die ("invalid query");
						 

	while($row = mysql_fetch_array($query2)){


							if ($row[student_id] == $student_id){
	
											// Checking to see if student level	
											if($program_level == 2){	

													 if ( $row['program_assignments_parts_id'] >= "65" && $row['program_assignments_parts_id'] <="70") 
													
													
														{ 
													
														print $row[program_assignments_parts_id] . "<br> "; 
													
														$row[program_assignments_parts_id]++;
														 
													
														}
														
														
														
											}
											//Checking to see if Suervisor Level			
											elseif($program_level == 3){			
														
														
														if ( $row['program_assignments_parts_id'] == "75" && $row['program_assignments_parts_id'] <="78")
														{ 
														print $row[program_assignments_parts_id] . "<br> "; 
													
														$row[program_assignments_parts_id]++;

														}  
														
														
											}
											// Checking to see if Manager Level	
											elseif($program_level == 4){	

													 if ( $row['program_assignments_parts_id'] >= "79" && $row['program_assignments_parts_id'] <="84") 
													
													
														{ 
													
														print $row[program_assignments_parts_id] . "<br> "; 
													
														$row[program_assignments_parts_id]++;
														 
													
														}
														
														
														
											}
											//Checking to see if Director Level			
											elseif($program_level == 5){			
														
														if ( $row['program_assignments_parts_id'] >= "85" && $row['program_assignments_parts_id'] <="90") 
													
													
														{ 
													
														print $row[program_assignments_parts_id] . "<br> "; 
													
														$row[program_assignments_parts_id]++;
														 
													
														}  
											}
											//Checking to see if Graduate Level			
											elseif($program_level == 6){			
														
														if ( $row['program_assignments_parts_id'] >= "91" && $row['program_assignments_parts_id'] <="96") 
													
													
		{ 
													
print $row[program_assignments_parts_id] . "<br> "; 
    $row[program_assignments_parts_id]++;				
												}  
											}		
	}			

}
}
[/php]

http://digg.com/hsu7kjj
I was told that every time you do a virus check, logs are kept and thats what eats memory. If true. How do you clear the logs???

Sponsor our Newsletter | Privacy Policy | Terms of Service