Skip to content
Permalink
6f8c975489
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
29 lines (24 sloc) 906 Bytes
int firstentry(){/*Enter your student details so they are saved in the database*/
cout << "Student ID"; cin >> studentID;
cout << "Name :"; cin >> name;
cout << "Surname :"; cin >> surname;
username = surname + name[0];
cout << "Enter your school email :"; cin >> email;
cout << "Password :"; cin >> password;
cout << "Enter Password again :"; cin >> retry;
if(retry == password){
sqlite3 *db;
char *column = 0;
int load;
string sql;
load = sqlite3_open("School.db", &db);
if(load){
cout << "DB Error: " << sqlite3_errmsg(db) << endl;
sqlite3_close(db);
return(1);
}
sql = "INSERT INTO STUDENTDETAILS VALUES(" + studentID + ',' + name + ',' + surname + ',' + username + ',' + email + ',' + password + ");";
load = sqlite3_exec(db, sql.c_str(), callback, 0, &column);
sqlite3_close(db);
cout << "Succesfully made your student login."<<endl;
secondentry();