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.
Right now it pulls from my DB and shows
71
72
73
74
Because that is what I have in the col within the DB. I want it to add 75 to it this time. Next time I access the page I want it to add 76 and so on.
Thanks,
AJ
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:
if ( $row['assignment_num'] >= "71" && $row['assignment_num'] <="78")
{
print $row[assignment_num] . "<br> ";
$row[assignment_num]++;
}
71
72
73
74
Because that is what I have in the col within the DB. I want it to add 75 to it this time. Next time I access the page I want it to add 76 and so on.
Thanks,
AJ
Comment