Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I'm hoping somebody can save me the pain of struggling through this one. I'm trying to copy records from one database to another. I am able to do this in the MySQL Query Browser but my code in PHP (follows) errors.Code: Select all
$dbc=@mysql_connect('localhost','CalcUser','dog') or die('ChangeAccountName: bad calcuser password: '.mysql_error());
$junk=mysql_select_db('calculator') or die('Could not select database:'.mysql_error());
$query="'insert into archive.account select * from calculator.account where dateadded<'$ArchiveDate' and PolicyNumber=''";
$result=mysql_query($query) or die('Archive:Insert acount: query='.$query.',error='.mysql_error());Code: Select all
Archive:Insert acount: query='insert into archive.account select * from calculator.account where dateadded<'2006-10-10' and PolicyNumber='',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 ''insert into archive.account select * from calculator.account where dateadded<'2' at line 1Weirdan | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]