Hello,
I have corrected the code as I would have written it. Also are you sure the
file mysql.h
is where you think it is?
#include stdio.h
#include mysql/mysql.h
main()
{
int sel;
MYSQL mysql=NULL;
MYSQL *connection;
MYSQL_RES *result;
mysql_init(mysql);
if(mysql == NULL)
{
printf(\n MySQL unable to intialise\n);
exit(-1);
}
connection=mysql_real_connect(mysql,23.22.2.2,user,pwd,db_name,0,NU
LL,0);
sel = mysql_query(connection, select e-no,ename from employee);
printf(sel %d\n,sel);
}
John Lodge
-Original Message-
From: udayashankarl_n [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 07, 2002 11:51 AM
To: [EMAIL PROTECTED]
Subject: C-API Query
Hi,
I have written the following code using C-API and would like to retrieve
the info from MYSQL.
But it gives me error messages. Please let me know where iam going
wrong.
the code and error messages are :
#include stdio.h
#include mysql/mysql.h
main()
{
int sel;
MYSQL *mysql=NULL;
mysql_init(mysql);
if(mysql == NULL)
{
printf(\n MySQL unable to intialise\n);
exit(-1);
}
mysql_real_connect(mysql,23.22.2.2,user,pwd,db_name,0,NULL,0);
sel = mysql_query(mysql, select e-no,ename from employee);
printf(sel %d\n,sel);
}
produces the following error messages.
/tmp/ccPhnnJk.o: In function `main':
/tmp/ccPhnnJk.o(.text+0x14): undefined reference to `mysql_init'
/tmp/ccPhnnJk.o(.text+0x5a): undefined reference to `mysql_real_connect'
/tmp/ccPhnnJk.o(.text+0x6d): undefined reference to `mysql_query'
collect2: ld returned 1 exit status
Regards
Uday
-
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
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
-
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 [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php