Auto Populating a table?

    Date: 03/17/06 (PHP Community)    Keywords: mysql, browser, sql

    I've writen a function


    auto_populate($file_name)
    {
        $file=file($file_name);
        foreach($file as $sql)
        {
           mysql_query($sql);
           echo $sql."< br >"; // To test the file is being processed
        }
    }

    if I call it with a filename (eg. auto_populate("test.txt");) I see the lines in the browser but the db still remains empty.

    each line is in the format

    insert into 'area' values(0, 'Yorkshire')

    am I missing something?

    Tia

    Pual

    Source: http://community.livejournal.com/php/427879.html

« :: vs -> || PHP Help »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home