Help: A simple code for PHP

Source: Internet
Author: User
Keywords Php
Tags php and mysql
Php

This is an example of the PHP and MySQL Web development book, which is intended to explode the order information stored in the file and display it in a table. Why do I only display headers when I run, no tabular data?
Orders.txt is the order information, tab-delimited, has been correctly read into the ers. There seems to be a problem in the for loop behind it.



Bob ' s Auto parts-customer Orders

Bob ' s Auto Parts

Customer Orders

Read the entire file
Each order becomes a element in the array
ers = File ("./orders.txt");

Count the number of orders in the Array_of_orders = count (ers); if (_of_orders = 0) {echo "

No orders pending. Please try again later.

";} echo " \ n "; echo" Oil Total "; for ($i = 0; $i < _of_orders; $i + +) {//split up all line $line = explode ("\ t", ers [$i]); Keep only the number of items ordered $line [1] = Intval ($line [1]); $line [2] = Intval ($line [2]); $line [3] = Intval ($line [3]); Output each other echo " ";} echo "
Order Date Tires Spark Plugs Address
". $line [0]." ". $line [1]." ". $line [2]." ". $line [3]." ". $line [4]." ". $line [5]."
";

?>

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