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"
Order Date |
Tires |
| Oil
Spark Plugs |
| Total
Address |
"; 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 "
". $line [0]." |
". $line [1]." |
". $line [2]." |
". $line [3]." |
". $line [4]." |
". $line [5]." |
";} echo "
";
?>