Thanks, Scott. I thought I couldn't have missed ','(comma) before. But today somehow it works... ;; I wasted hours figuring this out, but you saved me!
Maybe I'm still a complete newbie! Thanks, again. Have a great day. :) On Thu, Apr 30, 2009 at 12:52 PM, Scott Haneda <talkli...@newgeo.com> wrote: > > On Apr 29, 2009, at 11:29 AM, Antonio PHP wrote: > > This is MySQL data structure. - I underlined where it causes the error >> message. (datetime) >> `id_Company` smallint(6) unsigned NOT NULL AUTO_INCREMENT, >> `Name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL >> `Revenue` mediumint(6) NOT NULL, >> `Company_Size` mediumint(6) NOT NULL, >> `Ownership` tinyint(1) NOT NULL, >> `Homepage` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT >> NULL, >> `Job_Source` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT >> NULL, >> `Updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, >> *`Created` datetime NOT NULL, >> *PRIMARY KEY (`id_Company`), >> KEY `Ownership` (`Ownership`) >> ) >> ENGINE=InnoDB DEFAULT CHARSET=utf8 >> FOREIGN KEY (`Ownership`) REFERENCES `ownership` (`id_Ownership`) ON >> DELETE >> CASCADE ON UPDATE CASCADE; >> > > Next time can you include unmodified SQL so it is a copy and paste for me, > rather than debugging what changes you made that are causing error. > > Here is php script ----------------------------- >> $sql = "INSERT INTO company SET >> Name='$Name', >> Revenue='$Revenue', >> Company_Size='$Company_Size', >> Ownership='$Ownership', >> Homepage='$Homepage', >> Job_Source='$Job_Source' >> *Created=NOW() // if I remove this line it works fine. >> *"; >> mysql_query ($sql) or die (mysql_error()); >> > > Same here, as I am not sure your edits are just edits, or the lack of a > comma after the job source variable is the issue. > > This works on my end: > > $Name = 'Tom'; > $Revenue = '100'; > $Company_Size = '500'; > $Ownership = 'partner'; > $Homepage = 'example.com'; > $Job_Source = 'friend'; > > > $sql = "INSERT INTO mailing SET > Name='$Name', > Revenue='$Revenue', > Company_Size='$Company_Size', > Ownership='$Ownership', > Homepage='$Homepage', > Job_Source='$Job_Source', > Created=NOW()"; > > echo $sql; > > mysql_query ($sql) or die (mysql_error()); > > -- > Scott * If you contact me off list replace talklists@ with scott@ * > >