- Initialize a MYSQL object:
mysql_init(NULL);
- Establish a connection to the MySQL server running at the specified host. Also, generate a connection handler. The program will terminate if some error occurs in establishing the connection to the MySQL server engine or to the ecommerce database:
if (!mysql_real_connect(conn, server, user, password, database, 0, NULL, 0)) { fprintf(stderr, "%s\n", mysql_error(conn)); exit(1); }
- Enter the email address of the user whose information has to be updated:
printf("Enter email address of the user to update: ");scanf("%s", emailaddress);
- Create an SQL SELECT statement that will search the row in the users table that matches the email address that was entered by the user:
strcpy(sqlquery,"SELECT ...