Hi there,
here what my problem is - I'm trying to get data from MySQL database put in on global array and make calculation. The data in the MySQL table is 3000 rows and 2 columns. The type of data is double and date
Here is the code:
#include <stdlib.h>
#include <iostream>
#include <mysql.h>
#include <stdio.h>
MYSQL conn;
MYSQL_RES *res;
MYSQL_ROW msq_row;
int main()
{
double mysql_result[3000][2];
int i;
int j;
int history=3000;
mysql_init(&conn);
mysql_real_connect(&conn, "localhost", "root", "1a2s3d", "portfolio", 0, NULL, 0);
mysql_query(&conn, "SELECT date, close from quotes where companyID=1");
res=mysql_use_result(&conn);
for (j=0;j=history;j++)
{
for (i=0;i=mysql_num_fields(res);i++)
{
msq_row=mysql_fetch_row(res);
mysql_result[3000][2]=msq_row;
printf("%d\n",msq_row[i]);
}
}
mysql_free_result(res);
mysql_close(&conn);
return (EXIT_SUCCESS);
}
the cygwin g++ compiler give this:
/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `/cygdrive/c/Program Files/MyPrograms/Apache/htdocs/QuadProg++/Pordotovka'
/usr/bin/make -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin-Windows/pordotovka.exe
make[2]: Entering directory `/cygdrive/c/Program Files/MyPrograms/Apache/htdocs/QuadProg++/Pordotovka'
mkdir -p build/Debug/Cygwin-Windows
rm -f build/Debug/Cygwin-Windows/main.o.d
g++ -c -g -MMD -MP -MF build/Debug/Cygwin-Windows/main.o.d -o build/Debug/Cygwin-Windows/main.o main.cpp
main.cpp: In function `int main()':
main.cpp:45: error: cannot convert `char**' to `double' in assignment
make[2]: *** [build/Debug/Cygwin-Windows/main.o] Error 1
make[2]: Leaving directory `/cygdrive/c/Program Files/MyPrograms/Apache/htdocs/QuadProg++/Pordotovka'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/cygdrive/c/Program Files/MyPrograms/Apache/htdocs/QuadProg++/Pordotovka'
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 828ms)
Please give me gleam ... thank you