0

I want to move the MySQL stuff to include.h
so that I can include that into any cgi script
and then with ease use mysql queries.

how can it be done ?

#include <stdio.h>
#include <string.h>
#include <fcgi_stdio.h>
#include <stdlib.h>
#include <mysql.h>
#include "include.h"

int main() {

while (FCGI_Accept() >= 0) { 

MYSQL *conn;
MYSQL_RES *res;
MYSQL_ROW row;

char *server = "localhost";
char *user = "root";
char *password = "";  
char *database = "db";
conn = mysql_init(NULL);

if (mysql_real_connect(conn, server, user, password, database, 0, NULL, 0)) {


}else{

}

printf("Content-type: text/html;\r\n");
printf("\r\n");

FCGI_Finish();
}

  return 0;
}

0 Answers0