vsloathe

Alright so I've got a table with 4 fields, looks like this

TABLE `unique` (
  `id` int(11) NOT NULL auto_increment,
  `ip` varchar(20) NOT NULL default '',
  `regid` varchar(50) NOT NULL default '',
  `num` int(11) NOT NULL default '0',
  PRIMARY KEY  (`id`)
)


Why the hell would the query


$query="INSERT INTO unique (ip, regid, num) VALUES ('$ip','$key','1')";


Not work? I have checked, and it will not work if I fill in the values manually either, so it has nothing to do with the variables, I confirmed they're both being pro

perl

 y set.

vsloathe

Nevermind. Like an idiot I was using reserved words - in one table as the actual name, in another as a name of the attribute. I'm used to being pampered by MSSQL and flat out told I can't create a table with that name, lol.

Applause

arms

also you don't need to quote the ints but i don't know if that causes an error.

nutballs

$query="INSERT INTO unique (ip, regid, num) VALUES ('$ip','$key','<>1')";

the bold part should not be quoted. the field is INT but you are passing a string it would seem. Unless oracle doesnt care.

But yea, the unique part seemed kinda like an odd table name.

To avoid the reserved names I always name my tables Application_Tablename
Also means that if you need to combine apps into 1 DB, you wont have problems.

vsloathe

Yeah I realized that soon after I posted, that I was putting the 1 in quotes. Thanks for pointing that out guys.

Finally got it to work correctly.


Perkiset's Place Home   Politics @ Perkiset's