|
Hi,
i have a table with a field varchar(15).
I use the Mysql CAPI to get the value this field.
The problem is:
What's the function's type to return this
value?
What's the variable's type that will receive the
data?
In attach is a file with a piece of my
code.
Tanks for attention and please help
me. |
??? getip(void)
{
mysql_init(&mysql);
if(mysql_real_connect(&mysql,"localhost","root",NULL,"qosmib",0,NULL,0)!=NULL)
{
//ipdestino is varchar in the table
sprintf(query,"select distinct(ipdestino) from conexao order by ipdestino");
mysql_query(&mysql,query);
result=mysql_store_result(&mysql);
if(mysql_num_rows(result)!=0)
{
while((row=mysql_fetch_row(result))!=NULL)
{
return(&row[0]);
}
}
else
{
mysql_free_result(result);
mysql_close(&mysql);
return 0;
}
}
else
{
printf("Incapaz de conectar.\nErro: %s\n",mysql_error(&mysql));
}
return 0;
}
#######################################################################
void main()
{
??? result;
result=getip();
...
}
--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <mysql-unsubscribe-##L=##[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
