Hi All,
Need our expertise out there regarding the above mention error and below are the codes:
/* send SQL query */
bzero(query1, sizeof(query1));
sprintf(query1, "select a.CreateDate, a.MobileNumber, b.BillName, b.CorrName, b.ICNew, b.ICOld, b.Passport,"
"b.Addr, b.Addr2, b.Addr3, b.Addr4, b.Postcode, b.CountryCode from Register as a, Profile as b"
" where a.MasterNumber = b.Number and a.Status=0");
printf ("%s\n",query1);
if (mysql_query(&conn, query1))
{
fprintf(stderr, "%s\n", mysql_error(&conn));
exit(0);
}
res = mysql_use_result(&conn);
/* output fields 0, 1 and 2 of each row */
while ((row = mysql_fetch_row(res)) != NULL)
{
if (i==11)
{
timebuffer();
i=1;
bzero(string1, sizeof(string1));
}
else
{
sprintf(string1,"%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s",
row[0], row[1], row[14], row[15], row[16], row[17], row[18], row[4],
row[5], row[6], row[7], row[12], row[13]);
sprintf(mobileno,"%s", row[1]);
printf ("%s\n",string1);
printf ("Test: %s\n",mobileno);
writeLogFile(string1, mobileno);
i++;
}
}
When I run the program, it gives me "Segmentation Fault" and I think it's mayb becos of combining 2 tables.
Many thanks..