On Saturday 12 January 2002 10:42, Adam Royle wrote:
> Hi there...
> I wrote a PHP script which extracts the title and content from all the
> HTML files in a directory and puts the filename, title and content into
> a 2 dimensional array.
> I know the array is fine because when I print it to the page it dislays
> properly.
> When I try to input it into the DB I think mySQL chokes. Is there a
> better way to put contents of an array in a db, or some way to slow down
> the process?
> I have tried using insert delayed, and also doing a complex calculation
> after each insert to keep the php engine thiking but allowing mysql to
> fix itself, but this does not work. The results I get in the db is
> muffled and only contains three rows (instead of about 15) and the
> information is all jumbled aswell.
> I tried a test line (commented out) and it worked as expected. This is
> my code.
> for ($i=0;$i<count($arr_page);$i++){
>       $sql = "INSERT into tblContent
>                       (Title, Filename, Parent, DirName, Content)
>               VALUES
>       ('$arr_page[$i][0]','$arr_page[$i][1]','$parent','$dir_name','$arr_page[$i
>] [2]')";
>               //('$i','$i','$i','$i','$i')"; this line instead of previous
> inserts as expected
>       mysql_query($sql);
> }

You don't say what error, if any, you're getting. My best guess is that you 
probably need to use addslashes() to treat your data before inserting into 
the database.

Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

"I'd love to go out with you, but I did my own thing and now I've got
to undo it."

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to