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 7986111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:45:24+00:00 2026-06-04T11:45:24+00:00

I have on excel file that has the data of my student table. Now

  • 0

I have on excel file that has the data of my student table.
Now I am trying to import this file in mysql in my student table.
This is my code to import data from excel to my student table.

<?php
     require_once("class/connection.php");
     include("libs/Excel/reader.php");

    //change-- table name,title and imgdir
    $table_name = "student";
    $title="Excel Import";
    $page = $_SERVER['PHP_SELF'];

    if($_REQUEST["Save"])
    {
        // ExcelFile($filename, $encoding);
        $data = new Spreadsheet_Excel_Reader();
        // Set output Encoding.
        $data->setOutputEncoding('CP1251');
        //assign filename
        $data->read($_FILES['file']['tmp_name']);

    for ($x = 2; $x <= count($data->sheets[0]["cells"]); $x++) 
    {
      $studname = $data->sheets[0]["cells"][$x][1];
      $phno = $data->sheets[0]["cells"][$x][2];
      $mobno = $data->sheets[0]["cells"][$x][3];
      $email = $data->sheets[0]["cells"][$x][4];
      $clgname = $data->sheets[0]["cells"][$x][5];
      $streamname = $data->sheets[0]["cells"][$x][6];
      $remarks = $data->sheets[0]["cells"][$x][7];
      $gender = $data->sheets[0]["cells"][$x][8];
      $address = $data->sheets[0]["cells"][$x][9];

    $query = "INSERT INTO " . $table_name . "(studname,phno,mobno,email,clgname,streamname,remarks,gender,address) 
    values('$studname','$phno','$mobno','$email','$clgname','$streamname','$remarks','$gender','$address')";

        mysql_query($query) or die(mysql_error());
     }
  }  

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Admin Panel -<?php echo $title;?></title>
<link rel="SHORTCUT ICON" type="image/x-icon" href="images/cloelle_favicon.ico">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><?php include("header.php");?></td>
  </tr>
  <tr>
    <td align="center" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">

        <tr>



          <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  </table></td>
                <td width="6"><img src="images/home_box_rt.jpg" width="6" height="28" /></td>
              </tr>
              <tr>
                <td background="images/home_box_lbg.jpg">&nbsp;</td>
                <td height="120" align="center" valign="top" class="successmsg">
                    <?php
                        if($_REQUEST['submit'])
                        {
                            echo "Your data Transfered Successfully!";
                        }
                        else
                        {
                            echo "Please Upload Your Excel File Here!";
                        }
                    ?>
                  <form id="StdForm" name="StdForm" enctype="multipart/form-data" method="post" onsubmit="javascript: return chkValid();">
                    <p>
                      <input type="file" name="file" id="file" />
                    </p>
                    <p>
                      <input type="submit" id="Save" name="Save" class="button" value="submit" />
                    </p>
                  </form></td>
                <td background="images/home_box_rbg.jpg">&nbsp;</td>
              </tr>

            </table></td>

        </tr>

      </table></td>
  </tr>
  <tr>
    <td><?php include("footer.php"); ?></td>
  </tr>
</table>
</body>
</html>

now when I run this code following error is generated.

The filename C:\xampp\tmp\phpFCD3.tmp is not readable

so what am i missing.?
thanks in advance

  • 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-04T11:45:25+00:00Added an answer on June 4, 2026 at 11:45 am

    make sure that the file you are trying to read is saved in microsoft excel(.xls) format. I was too getting the same error when trying to read with excel reader then found that my .xls extension file is CSV formatted. so i opened my file and saved as microsoft excell(.xls), and it worked.

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

Sidebar

Related Questions

I have an Excel file that gets external data from database table. I need
I have a flat file source from Excel that has a structure like this:
I have the this code that will create excel file and work sheet then
I have a an excel file that has been manually populated, and now needs
I have an Excel file (which has data imported from Oracle 10G Database) one
I am trying to use an excel file that has data such as first
I have an Excel file that has columns A and B, both have data
I have a script that grabs data from a MySQL database table and creates
I have an Excel file that I need to import into a (new) Oracle
I basically have a program that filters records from one excel file to another

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.