Jump to content

[SOLVED] Help me decode an INSERT error...Stumped


mem0ri

Recommended Posts

I'm running a PHP5 site with a MySQL 4.1 database (yea, I'm asking the provider to update it to 5+)...

 

...I've got several INSERT, SELECT, UPDATE, etc. statements working great through my database classes--so we know the PHP isn't the problem...

 

I have a particularly long SQL statement:

 

$q = "INSERT INTO rentunit (id, name, region, position, rescom, price, prims, kowner, birth, ptype, active, lease, ishout, iauto, interval, t1, t2, t3, t4) 
	      VALUES ('$kobj','$sobj','$sregion','$vpos',0,$price,$prims,'$kowner',$birth,$ptype,0, 0, $shout, $auto, $interval, $t1, $t2, $t3, $t4) 
		  ON DUPLICATE KEY UPDATE name='$sobj', region='$sregion', position='$vpos', price=$price, prims=$prims, kowner='$kowner', ptype=$ptype, lease=0, ishout=$shout, iauto=$auto, interval=$interval, t1=$t1, t2=$t2, t3=$t3, t4=$t4";

 

That is acquiring proper information (I've done a die($q) to read what it translates into):

 

INSERT INTO rentunit (id, name, region, position, rescom, price, prims, kowner, birth, ptype, active, lease, ishout, iauto, interval, t1, t2, t3, t4) VALUES ('objectvalue','Name','Region ','positionvalue',0,1,50,'uservalue',2007-03-08 17:12:27,0,0, 0, 1, 1, 604800, 1, 2, 3, 4) ON DUPLICATE KEY UPDATE name='Name', region='Region ', position='positionvalue', price=1, prims=50, kowner='uservalue', ptype=0, lease=0, ishout=1, iauto=1, interval=604800, t1=1, t2=2, t3=3, t4=4

 

The table:

 

id-->VARCHAR40

name-->VARCHAR100

region-->VARCHAR25

position-->VARCHAR15

rescom-->TINYINT1  NULL

price-->INT5

prims-->INT5  NULL

kowner-->VARCHAR40

sugprice-->INT5  NULL

birth-->DATETIME

death-->DATETIME  NULL

ptype-->TINYINT1

active-->TINYINT1

lease-->INT11  NULL

ishout-->TINYINT1

iauto-->TINYINT1

interval-->INT8

t1-->INT7  NULL

t2-->INT7  NULL

t3-->INT7  NULL

t4-->INT7  NULL

 

 

The mysql_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 'interval, t1, t2, t3, t4) VALUES ('055bbe47-7df4-7037-acab-10eae649da73','CED Re' at line 1

 

Help?  Been wrackin' my brain for over an hour on just this one problem.

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.