[MySQL] Can't enter float into database.
#1

Hi there,
I am having trouble with inserting floats into my MySQL database.

In my database, my table has 3 fields called EntX, EntY, EntZ. Their types are all floats, and they don't have a length.

This is my code:
pawn Код:
CreateBusiness(1, "A Test", 20000, 0.0000, 0.0000, 4.0000); // Create Bizz.
//The Actual function.
function CreateBusiness(bid, Bizzname[], price, Float:EnterX, Float:EnterY, Float:EnterZ)
{
    if(bid > MAX_HOUSES) return 0;
    format(str, sizeof(str), "SELECT * FROM `bizzinfo` WHERE `bid` = %d", bid);
    mysql_query(str);
    mysql_store_result();
    if(mysql_num_rows() > 0) return 0;
    format(str, sizeof(str), "INSERT INTO `bizzinfo` (bid, BizzName, Owner, Price, PayAmount, EntX, EntY, EntZ) VALUES (%d, '%s', 'For Sale', %d, 5000, %f, %f, %f)", bid, Bizzname, price, EnterX, EnterY, EnterZ);
    mysql_query(str);
    printf("[BIZZ]: Business ID: %d was added to the database.", bid);
    mysql_free_result();
    return 1;
}
And this is what I get when I query it into the database.


This is my MySQL Log.
Код:
[Thu Sep 16 21:06:16 2010] -------------------------
[Thu Sep 16 21:06:16 2010]      Logging Started
[Thu Sep 16 21:06:16 2010] -------------------------
[Thu Sep 16 21:06:16 2010] Connected (0) to root @ localhost via TCP/IP.
[Thu Sep 16 21:06:16 2010] MySQL Version 5.1.36-community-log.
[Thu Sep 16 21:06:16 2010] Function: mysql_query executed: "SELECT * FROM `bizzinfo` WHERE `bid` = 1" with result: "0".
[Thu Sep 16 21:06:16 2010] Function: mysql_store_result executed with result: "1"
[Thu Sep 16 21:06:16 2010] Function: mysql_num_rows executed with result: "".
[Thu Sep 16 21:06:16 2010] Function: mysql_query executed: "INSERT INTO `bizzinfo` (bid, BizzName, Owner, Price, PayAmount, EntX, EntY, EntZ) VALUES (1, 'A Test', 'For Sale', 20000, 5000, 0.000000, 0.000000, 4.000000)" with result: "0".
[Thu Sep 16 21:06:16 2010] Function: mysql_free_result executed.
[Thu Sep 16 21:06:16 2010] Function: mysql_query executed: "SELECT * FROM `bizzinfo`" with result: "0".
[Thu Sep 16 21:06:16 2010] Function: mysql_store_result executed with result: "1"
[Thu Sep 16 21:06:16 2010] Function: mysql_num_rows executed with result: "".
[Thu Sep 16 21:06:16 2010] Function: mysql_fetch_row executed with result: "1|A Test|For Sale|20000|5000|0|0|4".
[Thu Sep 16 21:06:16 2010] Function: mysql_free_result executed.
Sigh,
Can anyone help please.
Reply


Messages In This Thread
[MySQL] Can't enter float into database. - by Toni - 17.09.2010, 02:02
Re: [MySQL] Can't enter float into database. - by Toni - 17.09.2010, 11:19
Re: [MySQL] Can't enter float into database. - by [HiC]TheKiller - 17.09.2010, 11:34
Re: [MySQL] Can't enter float into database. - by dirkblok - 17.09.2010, 12:54
Re: [MySQL] Can't enter float into database. - by xyu3xx - 17.09.2010, 14:05
Re: [MySQL] Can't enter float into database. - by playbox12 - 17.09.2010, 15:07
Re: [MySQL] Can't enter float into database. - by Toni - 17.09.2010, 19:39
Re: [MySQL] Can't enter float into database. - by Toni - 21.09.2010, 02:24
Re: [MySQL] Can't enter float into database. - by DiddyBop - 21.09.2010, 03:05
AW: [MySQL] Can't enter float into database. - by Fabsch - 21.09.2010, 09:38

Forum Jump:


Users browsing this thread: 3 Guest(s)