About Header ()

Source: Internet
Author: User
Header ("Content-type:application/vnd.ms-execl");
Header ("Content-disposition:filename=test.xls");
$con _db = mysql_connect ("localhost", "root", "patest");
mysql_select_db ("Dataput", $con _db);
$d = 0;
for ($i =0; $i <6; $i + +)
{
$sql = "INSERT into Progress (day,city) VALUES (' $d ', ' $i ')";
$insertdb _result=mysql_query ($sql, $con _db);
echo $i. "
";
$d + +;
}

The discovery data did not insert 6 data as expected, please enlighten the master


Reply to discussion (solution)

I don't know what you're doing.

For two purposes:
1. Inserting data into the DB
2. Echo, display some data on the page

You are now having problems inserting the database.


Or so, what does the above code do?

There is no output on the page because you use the header ("Content-type:application/vnd.ms-execl");

As for the inability to insert the library, you can open the saved Test.xls to read the newspaper what's wrong.

Yes, there is no output on the page.
But it is not impossible to insert the database but the expected is to insert 6, but inserted 12, have the same data repeated insertion (my main confused place)

  • 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.