acid2k
Doppel-As
servus leutz
kennt sich jemand mit der mysql c api aus??
ich hab folgendes problem
-----------------------------------+
MYSQL *connection, mysql;
MYSQL_ROW row,row_2;
MYSQL_RES *res;
MYSQL_RES *res_2;
int a,b,counter = 1;
char *variable;
char buffer[500];
char *query,*query_2;
char ip[20] = "";
// Verbindung zur Datenbank
mysql_init(&mysql);
system("clear");
head();
printf("\n\nPlease Enter the IP-adress of the database if databas is on localhost press enter\n\n");
printf("@>");
gets(ip);
system("clear");
head();
connection = mysql_real_connect(&mysql,ip,"","","db",0,NULL,0);
// Fehlerüberprüfung beim Verbindungsaufbau
if(connection == NULL)
{
printf(mysql_error(&mysql));
return 1;
}
else
{
printf("\n\n@> Connection to database %s Successful\n\n",&ip);
}
/* Abfrage an MySql [1] */
query = "SELECT * FROM test";
a = mysql_query(connection,query);
if(a)
{
printf("@> Query Error\n\n ");
}
else
{
printf("@> Query Successful\n\n");
res = mysql_use_result(&mysql);
}
/* Abfrage an MySql [2] */
query_2 = "SELECT * FROM config";
b = mysql_query(connection,query_2);
if(b)
{
printf("@> Query_2 Error\n\n ");
}
else
{
printf("@> Query_2 Successful\n\n");
res_2 = mysql_use_result(&mysql);
}
------------------------------+
beim ersen mal bekomme ich
query successful raus
beim 2
query_2 error
hab ich da was übersehen???????????
kennt sich jemand mit der mysql c api aus??
ich hab folgendes problem
-----------------------------------+
MYSQL *connection, mysql;
MYSQL_ROW row,row_2;
MYSQL_RES *res;
MYSQL_RES *res_2;
int a,b,counter = 1;
char *variable;
char buffer[500];
char *query,*query_2;
char ip[20] = "";
// Verbindung zur Datenbank
mysql_init(&mysql);
system("clear");
head();
printf("\n\nPlease Enter the IP-adress of the database if databas is on localhost press enter\n\n");
printf("@>");
gets(ip);
system("clear");
head();
connection = mysql_real_connect(&mysql,ip,"","","db",0,NULL,0);
// Fehlerüberprüfung beim Verbindungsaufbau
if(connection == NULL)
{
printf(mysql_error(&mysql));
return 1;
}
else
{
printf("\n\n@> Connection to database %s Successful\n\n",&ip);
}
/* Abfrage an MySql [1] */
query = "SELECT * FROM test";
a = mysql_query(connection,query);
if(a)
{
printf("@> Query Error\n\n ");
}
else
{
printf("@> Query Successful\n\n");
res = mysql_use_result(&mysql);
}
/* Abfrage an MySql [2] */
query_2 = "SELECT * FROM config";
b = mysql_query(connection,query_2);
if(b)
{
printf("@> Query_2 Error\n\n ");
}
else
{
printf("@> Query_2 Successful\n\n");
res_2 = mysql_use_result(&mysql);
}
------------------------------+
beim ersen mal bekomme ich
query successful raus
beim 2
query_2 error
hab ich da was übersehen???????????