Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
only update missing
  • Loading branch information
“craciun2” committed Mar 9, 2018
1 parent 02894ca commit 441545eeda19b84d41438a3caff42c1a337fd016
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 20 deletions.
13 Ideas

This file was deleted.

@@ -56,14 +56,71 @@ class PlayerInfo {

}//end changePassword

void updateDetails()
void updateDetails(int Player_ID) // function that alows the user to updtade his details like mail, mentality, age, favourite club.
{
update:
string email, mentality, nationality, favourite_club;
int age;
cout << "Input your age"<< endl;
cin>> age;
cout << "Input your email"<< endl;
cin>> email;
cout << "Input your mentality"<< endl;
cin>> mentality;
cout << "Input your nationality"<< endl;
cin>> nationality;
cout << "Input your favourite club"<< endl;
cin>> favourite_club;

// updting edtails on BD
sqlite::sqlite db( "ball.sqlite" );
auto cur = db.get_statement();
cur->set_sql( " UPDATE Player SET Email = ? , Mentality = ? , Age = ? , Nationality = ? , Club = ? WHERE Player_ID = ? ; " );
cur->prepare();
cur->bind( 1, email );
cur->bind( 2, mentality );
cur->bind( 3, age );
cur->bind( 4, nationality );
cur->bind( 5, favourite_club );
cur->bind( 6, Player_ID );
int result= cur->step();
if (result == true)
{
cout<<"Details Updated Sucessful"<<endl;
}
else
{
cout<<"Something went wrong"<<endl << "Try Again" << endl;
goto update;
} //end else case


} // end updateDetails

void printDetails()
void printDetails(int Player_ID)
{

// showing details from the user
sqlite::sqlite db( "ball.sqlite" );
auto cur = db.get_statement();
cur->set_sql( " SELECT * FROM Player WHERE Player_ID = ? ; " );
cur->prepare();
cur->bind( 1, Player_ID );

while( cur->step() )
{ // loop over results#
cout << "*******************************\n";
cout << "Here are you actual details"<< endl;
cout << "UserName:" << cur->get_text(1) << endl;
cout << "Email:" << cur->get_text(2) << endl;
cout << "Mentality:" << cur->get_text(4) << endl;
cout << "Age:" << cur->get_int(5) << endl;
cout << "Nationality:" << cur->get_text(6) << endl;
cout << "Favorite Club:" << cur->get_text(7) << endl;
cout << "*******************************\n";

}


}

};// end clas PlayerInfo
@@ -119,7 +176,7 @@ int MenuGame(int Player_ID){

cout << "*******************************\n";
cout << " 1 - Personalize yourself"<< endl;
cout << " 2 - Change Password "<< endl;
cout << " 2 - Change Password "<< endl;
cout << " 3 - Go Back"<< endl;

cout << " Enter your choice and press return: ";
@@ -134,8 +191,11 @@ int MenuGame(int Player_ID){
{
case '1':
{

cout << " Choice 1 ";

PlayerInfo obj1;
obj1.printDetails(Player_ID);
obj1.updateDetails(Player_ID);

goto MenuSettings;
break;
} // end case 1 personalize yourself
@@ -152,7 +152,7 @@ char menuu()
int result= cur->step();
if (result == true)
{
cout<<"The username or email are already in use!"<<endl;
cout<<"The username or email are already in use! Try Again"<<endl;
goto regist;
}//end of if case
else
BIN +8 KB (110%) ball.sqlite
Binary file not shown.
BIN +4.36 KB (110%) main_program
Binary file not shown.

0 comments on commit 441545e

Please sign in to comment.