Hello All,

Here is the information about the php that is being run and that is
4.3 MySQL is version 3.23.58.

I am geting this error when prossessing the below code, the code has
been adjusted to just show some of the data feilds and etc but the
back bone is there still:

Error:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link
resource in /home/httpd/vhosts/sample.net/httpdocs/convert_data.php on
line 54

Note:  I will put a comment after what would of been line 54:

******************** Start of code ********************

<?php

// Checks to see if var was passed from form and if was it continuals
with scripte if not goes to error message.
if(isset ($_POST['filename']));

// Brings $_POST['filename'] to $file
$file = $_POST['filename'];

//Set variables for Connecting to the database
$host = "localhost";
$user = "NPDB";
$password = "************";
$database = "NF-NPDB";

$conn = mysql_connect($host, $user, $password, $database) or die(
mysql_error() );

//Set variable to creat table if not existing
$sql = "CREATE TABLE IF NOT EXISTS nfnpdb
        (
        EIN  int(11),
        PNO  varchar(70),
        ICN  varchar(35)
        )";

if (mysql_query( $conn, $sql )) {   // THIS is line 54 this is what
the error is being caused by

// SUCK FILE INTO ARRAY
$rows = file( '$file' );
foreach( $rows as $i => $row ) {

// PARSE EACH LINE
$data = array();
        $data[0] = substr( $row, 1,9);
        $data[1] = substr( $row, 10,79);
        $data[2] = substr( $row, 80,114);

// INSERT IT

$sql = "INSERT INTO nfnpdb VALUES
        (
        $data[0],
        '$data[1]',
        '$data[2]'
        )";

mysql_query( $conn, $sql );
}
}

mysql_close( $conn );

?>
******************** End of Code ********************

Added infromation just so you know this script has 31 feilds that its
doing this for and this script is prossessing over 400k records at a
time if I could get a single file to be used then it would be 1.4
million records each month.  each file if I have to do it by state are
about 10-20mbs.

If any one knows of a BETTER way of writing this please help with this
as I am not the greatest at this or even good for that fact at less
yet :-)

THANKS to any one that could help with this and making this code better also.

Sincerly,
Christopher & Missy


Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to