After PHP imports Excel into MySQL database, how to make it appear in text form

Source: Internet
Author: User
After PHP imports Excel into MySQL database, how to make it appear in text form
Like in Excel, it's 9787509345030.
After importing the database, it becomes 9.78750934503E+12.
PHP to read the database data, found also 9.78750934503E+12
To be annoyed, to ask for help, the mood is very complicated.
It seems to be a numerical type, I am obviously
$number = Implode ("', Explode ('-'), $data->sheets[0][' cells '] [$i][1]));
$number = Strval ($number);
Make it into a string type, why is the meter or numerical type????


Reply to discussion (solution)

Your 9787509345030 is not stored as a string in Excel (' 9787509345030 '), but rather as a stylesheet-style (otherwise it is scientific notation)
You can try to read by using the GetFormattedValue method instead of the GetValue method

Your $data->sheets[0][' cells ' [$i][1] There's a problem.

I am csdn a person to learn the wording of the
$data = new Spreadsheet_excel_reader ();
$data->setoutputencoding (' utf-8 ');

$data->read ($upload _file_name);

for ($i = 2; $i <= $data->sheets[0][' numrows '); $i + +)
{
$user _name = $_session[' user_name ');
$book _ISBN = $data->sheets[0][' cells '] [$i][1]));
$book _name = $data->sheets[0][' cells ' [$i][2];
$book _press = $data->sheets[0][' cells ' [$i][3];
}
How did you write it, please?
Formatted read how to write, I looked at the official PHP file to me, I did not read.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.