How to do it…

  1. Initialize a MYSQL object:
mysql_init(NULL);
  1. 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); }
  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);
  1. 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 ...

Get Practical C Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.