--- Christopher E <[EMAIL PROTECTED]> wrote:
> Hello All,
>
> I am geting a error with this peice of code:
>
> <?php
>
> //Set variables for Connecting to the database
> $conn = mysqli_connect( "localhost", "UN", "PW", "DBN" )
> or die( mysql_error() );
>
> //Set variable to creat table if not existing
> $sql = "CREATE TABLE IF NOT EXISTS nfnpdb-t
> (
> EIN int(11)
> PNO varchar(70)
> )";
>
> $file = "uploads/eo_ma.lst"
>
> if( mysql_query( $conn, $sql )) {
>
> // BRING 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);
>
> // INSERT ARRAY INTO DATABASE NOW
> $sql = "INSERT INTO nfnpdb-t VALUES
> (
> $data[0],
> '$data[1]',
> )";
>
> mysqli_query( $conn, $sql );
> }
> }
>
> mysqli_close( $conn );
> ?>
>
> the error is:
> Parse error: parse error in
> /home/httpd/vhosts/seas-network.org/httpdocs/convert-upload-data.php
> on line 16 <--- Note that with all ofter fields it would be line 46.
>
> Thank you for any and all help with this.
>
> By the way if the is a better way to write this please show me :-)
Without looking at the details, you are missing a simicolon at the end of the
line:
$file = "uploads/eo_ma.lst"
This will generate the error you are seeing. I didn't look for other errors.
James
_____
James D. Keeline
http://www.Keeline.com http://www.Keeline.com/articles
http://Stratemeyer.org http://www.Keeline.com/TSCollection
http://www.ITeachPHP.com -- Free Computer Classes: Linux, PHP, etc.
Spring Semester January-June 2006. Two new class topics.
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/