[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
HELP: C API: mysql_query INSERT not working...
I'm not getting any errors at all and the program runs just fine, except
that it's not inserting! :) selects work and everything else. Am I
missing a function or structure? Thanks...
James Gosnell
goose@xxxxxxxxxxxx
#include <stdio.h>
#include <mysql/mysql.h>
#include <sys/time.h>
int main (void) {
MYSQL *connection, mysql;
if (!mysql_init(&mysql)) {
printf("Error initializing MySQL client\n");
exit(1);
}
if (!(connection = mysql_real_connect(&mysql, "localhost", "root", "fender", "", 0, "/tmp/mysql.sock", 0)))
printf(mysql_error(&mysql));
if (mysql_stat(connection)) printf("%s\n", mysql_stat(&mysql));
if ((mysql_query(connection, "insert into customer
(last_name,first_name,middle_name,address,city,state,zip,home_phone) VALUES
('Gosnell','James','Matthew','1008 Rhoads Hall','Terre
Haute','IN','47809','812-237-7094')")))
mysql_error(connection);
mysql_close(connection);
exit(1);
}
---------------------------------------------------------------------
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 <mysql-thread77925@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail <mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
This mailing list archive is a service of Copilot Consulting.