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;
}
[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.
EntX, EntY and EntZ all need to be varchars (pretty sure).
|
With lenght you mean numbers after the point?
If that's true, you need varchars |
'EntX, EntY, EntZ' needs to be 'float' as a table, and I am sure about that. I guess you didn't do that.
|
CREATE TABLE IF NOT EXISTS `bizzinfo` ( `bid` int(5) NOT NULL, `BizzName` varchar(24) NOT NULL, `Owner` varchar(24) NOT NULL, `Price` int(12) NOT NULL, `PayAmount` int(12) NOT NULL, `EntX` float NOT NULL, `EntY` float NOT NULL, `EntZ` float NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1;