Skip to content
Permalink
master
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
#ifndef INSERT_DB_H
#define INSERT_DB_H
#include <iostream>
#include "select_db.h"
#include "libsqlite.hpp"
using namespace std;
int insert_db(int studentID, string name, string surname, string username, string email, string password)
{/*insert the student details into database*/
try{
cout << studentID << name << surname << username << email << password <<endl;
sqlite::sqlite db("School.db");
auto cur = db.get_statement();
cur->set_sql( "INSERT INTO STUDENTDETAILS VALUES(?,?,?,?,?,?);" );
cur->prepare();
cout << "here" << endl;
cur->bind( 1, studentID );
cur->bind( 2, name );
cur->bind( 3, surname );
cur->bind( 4, username );
cur->bind( 5, email );
cur->bind( 6, password );
cur->step();
}
catch( sqlite::exception e )
{
cerr << e.what() << endl;
return 1;
}
return 0;
}
#endif