Hello what i am trying to achieve is combining this line of code: This is for my user Registrar
if (isset($_POST['unenroll'])){
$sql1="Update tbl_enroll SET status='unEnrolled'";
$unEn = mysql_query($sql1) or die (mysql_error());
}
To another code that will truncate ONLY the field in my database which is COUNT
So far this is what I am thinking:
if (isset($_POST['unenroll'])){
$sql1="Update tbl_enroll SET status='unEnrolled'";
$unEn = mysql_query($sql1) or die (mysql_error());
$trunc="Delete count from tbl_enroll";
$restart = mysql_query($trunc) or die (mysql_error());
}
By the way the column i want to delete all data while maintaining the column is count am i doing this right? Cause i don’t wanna erase all data right now,Also is this coding structure correct? Why i am doing this is because i have an action in my system that would allow another type of user to update only 3 times so i want my registrar if a certain period is met the registrar would restart the count to begin again at 0. (With my basic knowledge I’m trying to learn mysql, don’t need to remind me about Mysqli or PDO i’ll get there when I’m better)
EDITED: please read again.
EDITED: My bad so truncate is a bad idea. I just want the column count in my database to erase/refresh the entire data but maintaining the column itself.
Since you requested my comment in answer form, you can simply combine more update of columns after SET with an comma making your code: