Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8939263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:47:17+00:00 2026-06-15T10:47:17+00:00

I have the code with php using bulk insert.,I run the code and there

  • 0

I have the code with php using bulk insert.,I run the code and there is no error., The Problem there is no OUTPUT with this code and blank page/screen appear .. All I want to do is to have the Output with the page and with the database using this code ..

 <?php

     $dbh = odbc_connect(
           "DRIVER={SQL Server Native Client 10.0};Server=.;Database=ECPNWEB", 
           "sa", "ECPAY");




 if (($handle = fopen("c:\\tblmcwd.txt", "r")) !== FALSE) {
     while (($data = fgetcsv($handle, 4096, "|")) !== FALSE) {
         if (count($data) == 10) {
             $sql = "INSERT INTO [dbo].[tblMCWD] (
                         [ID], 
                         [ConsumerCode], 
                         [ConsumerName], 
                         [AccountStatus], 
                         [AccountNumber], 
                         [DueDate], 
                         [CurrentBill], 
                         [PreviousBill], 
                         [TotalDiscount], 
                         [TotalGrossAmountDue]
                     ) VALUES (
                         ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
                     )";

             $stmt = $dbh->prepare($sql);
             $stmt->bindValue(1, $data[0]);
             $stmt->bindValue(2, $data[1]);
             $stmt->bindValue(3, $data[2]);
             $stmt->bindValue(4, $data[3]);
             $stmt->bindValue(5, $data[4]);
             $stmt->bindValue(6, $data[5]);
             $stmt->bindValue(7, $data[6]);
             $stmt->bindValue(8, $data[7]);
             $stmt->bindValue(9, $data[8]);
             $stmt->bindValue(10, $data[9]);
             $stmt->execute();
         }
     }
     fclose($handle);
 }
 ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:47:18+00:00Added an answer on June 15, 2026 at 10:47 am

    Try this:

    ....
    
    $sql = "INSERT INTO [dbo].[tblMCWD] (
                         [ID], 
                         [ConsumerCode], 
                         [ConsumerName], 
                         [AccountStatus], 
                         [AccountNumber], 
                         [DueDate], 
                         [CurrentBill], 
                         [PreviousBill], 
                         [TotalDiscount], 
                         [TotalGrossAmountDue]
                     ) VALUES (
                         :ID, :ConsumerCode, :ConsumerName, :AccountStatus, :AccountNumber, :DueDate, :CurrentBill, :PreviousBill, TotalDiscount, TotalGrossAmountDue
                     )";
    $stmt = $dbh->prepare($sql);
    $stmt->bindParam(':ID', $data[0]);
    $stmt->bindParam(':ConsumerCode', $data[1],PDO::PARAM_STR);
    $stmt->bindParam(':ConsumerName', $data[2],PDO::PARAM_STR);
    $stmt->bindParam(':AccountStatus', $data[3],PDO::PARAM_STR);
    $stmt->bindParam(':AccountNumber', $data[4],PDO::PARAM_STR);
    $stmt->bindParam(':DuaDate' , $data[5],PDO::PARAM_STR);
    $stmt->bindParam(':CurrentBill', $data[6],PDO::PARAM_STR);
    $stmt->bindParam(':PreviousBill', $data[7],PDO::PARAM_STR);
    $stmt->bindParam(':TotalDiscount', $data[8],PDO::PARAM_STR);
    $stmt->bindParam(':TotalGrossAmountDue', $data[9],PDO::PARAM_STR);
    $stmt->execute();
    
    if(!$stmt){    // Check if the query executed succesfull, if not, print the data...
        $printedString = "ID: %1$s ConsumerCode: %2$s ConsumerName: %3$s"; // and so on....
        $printedString = sprintf($printedString , $data[0],$data[1],$data[2]); // and so on...
    } else{
        echo "Everything executed succesfully!<br />";
    }
    

    More info can you find here: Link
    And here: Link 2
    And here: Link 3

    Use PDO::PARAM_STR for strings and PDO::PARAM_INT for an integer, and give it an try

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this simple code to load data from other php page using get
I'm makin' a scripting language interpreter using PHP. I have this code in that
I am using gettext in my PHP code, but I have a big problem.
Hi We have some php code using the file_get_contents() function, and I understand this
Im using PHP code to create a dropshadow effect on images. I have this
Using SQLite in PHP (thus using PDO), I have this code: try { $db
I have this code here in PHP using Codeigniter framework, I can't seem to
I have a problem with PHP code : I have been using PHP to
I just started using php arrays (and php in general) I have a code
How to change the width/height if I have the following code and using php:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.