How to modify a value in one of the field while fetching MySQL???
Posted by: Surgey Pushkin
Date: August 17, 2011 12:29AM

Hi, I have tried many things, did not work, what I need is to modify MediumINT Column while fetching MySQL. But it fails! Here is the code:

MYSQL *conn;

char *server = "";
char *user = "myuser_name";
char *password = "password"; /* set me first */
char *database = "database1";
conn = mysql_init(NULL);

while ( !mysql_real_connect(conn, server,user, password, database, 0, NULL, 0) )
{ ::MessageBox(HWND_DESKTOP,"Cannot connect to MySql","Help",MB_OK);
::MessageBox(HWND_DESKTOP,"To Resolve, Fix Internet Connection or Credentials!","Help",MB_OK);

int ip = mysql_query(conn,"SELECT * FROM Student_Database");

res = mysql_use_result(conn);

long row_num = 0;

if (ip==0)
while ((row = mysql_fetch_row(res)) != NULL)

char * row_s;

row[5] = row_s; // Here I want to modify the value.

/* HERE I have a column name "Count",which is INTMEDIUM, which I would want to modify, as I fetch the numbers of the rows from 0,1,2,3... and so on...*/
/* I would want to place 0,1,2,and so on... BUT ii fails!, I have 6 fields, row[0],row[1],row[2],row[3],row[4],row[5] want to modify the last one. */



Any body know how this can be done???

Options: ReplyQuote

Written By
How to modify a value in one of the field while fetching MySQL???
August 17, 2011 12:29AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.