While loop
Posted: Tue Feb 22, 2011 7:46 pm
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: I have a table called assignment and a col that is called assignment_num which has 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 to only insert one from here.
Thanks,
DixieStudent
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: I have a table called assignment and a col that is called assignment_num which has 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 to only insert one from here.
Code: Select all
if ( $row['assignment_num'] >= "71" && $row['assignment_num'] <="78")
{
print $row[assignment_num] . "<br> ";
$row[assignment_num]++;
}
Thanks,
DixieStudent