Hi......
   
         There is an error in mysql_query( $conn, $sql ) statement.
   swap the parameters and check .The first parameter should be Query and the 
secong is Connection link
  Correct is "mysql_query( $sql,$conn ) "
        Hope this works ...
   Thank You
   
  Regards 
  Mohd Asif Ali
  

Christopher E <[EMAIL PROTECTED]> wrote:
  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 



  SPONSORED LINKS 
        Php mysql   Job postings 
    
---------------------------------
  YAHOO! GROUPS LINKS 

    
    Visit your group "php-list" on the web.
    
    To unsubscribe from this group, send an email to:
 [EMAIL PROTECTED]
    
    Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 

    
---------------------------------
  



                
---------------------------------
Blab-away for as little as 1ยข/min. Make  PC-to-Phone Calls using Yahoo! 
Messenger with Voice.

[Non-text portions of this message have been removed]



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