[fpc-pascal] Insert into ... mysql
Hi all !! I did! I can now connect and query to mysql fpc 2.2.4, console, Macosx 10.5 leopard, Mac book Intel But I can't (may be I dont know :-( ) insert data in a table connect mysql ... ok select db ... ok . new(consulta); consultastr:='INSERT INTO lugares (lugar) values (''Sala'')'; strPCopy(consulta,consultastr); writeln ('Executing query : ',Consulta,'...'); if (mysql_query(sock,consulta) 0) then begin Writeln (stderr,'Query failed '); writeln (stderr,mysql_error(sock)); Halt(1); end; -- What is wrong? Thanks in advance -- --- César Espinoza Soto - ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Insert into ... mysql
2009/6/28 César Espinoza cesarespinozas...@gmail.com: Hi all !! I did! I can now connect and query to mysql fpc 2.2.4, console, Macosx 10.5 leopard, Mac book Intel But I can't (may be I dont know :-( ) insert data in a table connect mysql ... ok select db ... ok . new(consulta); consultastr:='INSERT INTO lugares (lugar) values (''Sala'')'; strPCopy(consulta,consultastr); Is there enough space allocated for consulta to take length(consultastr)+1? Why don't you just use: mysql_query(sock,PChar(consultastr))? Henry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Insert into ... mysql
On Sun, 28 Jun 2009 15:42:04 -0500 César Espinoza cesarespinozas...@gmail.com wrote: But I can't (may be I dont know :-( ) insert data in a table If you can query, but not insert, there are a few things to check: - Is the syntax of your insert correct? I mean, does column 'lugar' exist, and is it a varchar column, etc.? - Are you allowed to insert? (Check the privileges for the person as who you log in. Insert, update, select, all have separate 'enables') - What is the message returned by mysql_error? John ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal