void SignUp()
{
MYSQL* conn;
MYSQL_ROW row;
MYSQL_RES* res;
int nQueryState = 0;
int nId = 0;
char szName[45];
char szPassWord[45];
char szQuestion[45];
char szPhone[45];
cout<<"Enter the Id";
cin>>nId;
cout<<"Enter the Name";
cin>>szName;
cout<<"Enter the Password";
cin>>szPassWord;
cout<<"Enter the Question";
cin>>szQuestion;
cout<<"Enter the Phone";
cin>>szPhone;
conn = mysql_init(0);
conn =mysql_real_connect(conn,"localhost","root","12356","hari",0,NULL,0);
nQueryState = mysql_query(conn,"insert into userdetails values(nId,szName,szPassword,szQuestion,szPhone)");
if(0!=nQueryState)
{
cout<<"\n\nConnection not Established";
}
}
I want to enter details into table named userdetails. It give me an output such that connection not esatablished.please go through it and help me. I'm using codeblock ide and mySql5.1