In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > I am very new at this and am having trouble migrating to php and mysql from > a different system (WebCatalog). > > I want to start dumping files to text and let php use them to populate mysql > on the fly as I start migrating. > > ----------------snip----------------------- > > $db = mysql_pconnect("host", "user", "pass"); > > $query = "insert into catalogwinetmp values > include("testsql")"; > > $result = mysql_query($query); > > ---------------end-snip-------------------- > > The contents of "testsql" look like this > > (19, 38080, 'Senejac', 'Haut-Medoc / Cru Bourgeois', '', 12, 1995, 'Bottle - > .75L', 'LN, LE, CI', 135, '/collectors/images/bottles/38080.JPG'), > (20, 38780, 'Yquem', 'Sauternes / Premier Cru Superieur', '', 1, 1927, > 'Bottle - .75L', 'TS, LP, CI', 465, '/collectors/images/bottles/38780.JPG'); > > Just with more lines (1-18). > > But I can not get rid of errors in the > $query = "insert into catalogwinetmp values > include("testsql")"; > No matter what quotes and semi-colons I put in testsql or in this script. > > If I try to set the contents of the include into a variable as in: > > $rowsToAdd = include(testsql); > > all I get is the value 1, I guess this is because it is successful. > > If I could get a variable to contain the contents of the include I am not > sure if I could use it in the script. > > I am not sure if I am even getting warm or if I am on another planet. > > > 1. Any ideas how I can simply make php get a text file into the mysql > database? > > 2. Is there a way to set a (albeit maybe large) variable with the contents > of an include file? > > Sorry to sound like such a php newbie, but I am.
I think you might want to consider an alternative method; it appears you have some control over the format of the text files being created, so why not create them in a format that is usable by the Mysql LOAD DATA INFILE function? -- David Robley Temporary Kiwi! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php