Jump to content

INSERT INTO won't work


Nuv

Recommended Posts

I don't understand why won't my INSERT work. Nothing gets inputted to the database.Why ?

Code

 $sql = "INSERT INTO payout (member_id, binary, tds, service, total, dues, amount_paid) VALUES ('".$memid."', '".$binary."', '".$tds."', '".$service."', '".$total."', '".$dues."', '".$amount_paid."')";
     $execsql = mysql_query($sql);

 

SQL table

CREATE TABLE IF NOT EXISTS `payout` (
  `member_id` int( NOT NULL,
  `binary` int(10) NOT NULL,
  `tds` decimal(7,2) NOT NULL,
  `service` decimal(7,2) NOT NULL,
  `total` int(10) NOT NULL,
  `dues` int(10) NOT NULL,
  `amount_paid` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

 

Link to comment
https://forums.phpfreaks.com/topic/235868-insert-into-wont-work/
Share on other sites

I don't understand why won't my INSERT work. Nothing gets inputted to the database.Why ?

This is exactly why PHP.net created the mysql_error function... and you can either use die to show it or just echo it out.

$execsql = mysql_query($sql) or die(mysql_error());

 

Error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'binary, tds, service, total, dues, amount_paid) VALUES ('1000000', '200', '10.6'' at line 1

 

Echo of sql statement

INSERT INTO payout (member_id, binary, tds, service, total, dues, amount_paid) VALUES ('1000000', '200', '10.6', '20.4', '170', '0', '170')

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.