Jump to content

patrick87

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

patrick87's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. The compay i am doing a website for wants a Last Updated: DATE added to the csv file of the prices page i have for them. the script was from a person here... for the csv file.. [code] <?PHP ############################################ # this gets the price.csv file and displays the data # #    IMPORTANT: Array elements begin with the number 0 (zero) # #    this entire example is predicated upon the use of a #    predetermined excel template # #    as you become more proficient, you will be able to #    modify this script to dynamically adjust ############################################# ############################################################### # read the csv file into an array # #    this array has elements that represent each row of the excel file #    each element will have data separated by commas #    we will turn each element into a new array so that we can extract the data ############################################################### $array_01 = file("price.csv"); ################################################### # count the number of elements in the first array ################################################### $elements_01 = count($array_01); ####################################################################### # get the location - based upon our excel template # this information would be the 2nd piece of data in the first element #    in our example the first element looks like this #    location,London,,,,, $array_02 = explode(",", $array_01[0]); $location = $array_02[1]; ############################################################################ # get the months for which we have prices - based upon our excel template # this information would be the 2nd through 6th pieces of data in the 2nd element #    in our example the second element looks like this #    month,April,May,June,July,August $array_03 = explode(",", $array_01[1]); $month01 = $array_03[1]; $month02 = $array_03[2]; $month03 = $array_03[3]; $month04 = $array_03[4]; $month05 = $array_03[5]; ################################################################################ #### # get the crop names as well as the relevant prices - based upon our excel template # this information would be in the elements 3 through 5 #    in our example those elements look like this #    corn,12.5,9.75,8,13.37,6 #    soybean,3.25,4.68,5.23,4.5,2 #    wheat,7.5,4.75,2,10.37,23.98 $array_04 = explode(",", $array_01[2]); $array_05 = explode(",", $array_01[3]); $array_06 = explode(",", $array_01[4]); $crop_01_name = $array_04[0]; $crop_01_price01 = "$".number_format($array_04[1], 2, '.', ','); $crop_01_price02 = "$".number_format($array_04[2], 2, '.', ','); $crop_01_price03 = "$".number_format($array_04[3], 2, '.', ','); $crop_01_price04 = "$".number_format($array_04[4], 2, '.', ','); $crop_01_price05 = "$".number_format($array_04[5], 2, '.', ','); $crop_02_name = $array_05[0]; $crop_02_price01 = "$".number_format($array_05[1], 2, '.', ','); $crop_02_price02 = "$".number_format($array_05[2], 2, '.', ','); $crop_02_price03 = "$".number_format($array_05[3], 2, '.', ','); $crop_02_price04 = "$".number_format($array_05[4], 2, '.', ','); $crop_02_price05 = "$".number_format($array_05[5], 2, '.', ','); $crop_03_name = $array_06[0]; $crop_03_price01 = "$".number_format($array_06[1], 2, '.', ','); $crop_03_price02 = "$".number_format($array_06[2], 2, '.', ','); $crop_03_price03 = "$".number_format($array_06[3], 2, '.', ','); $crop_03_price04 = "$".number_format($array_06[4], 2, '.', ','); $crop_03_price05 = "$".number_format($array_06[5], 2, '.', ','); ################################################################### # display the data in a nicely formatted table ?>[/code] [b]is there a easy way to add a line so that i can make a line in the csv file to add.. Last Updated: and give a date?[/b]
  2. ok.. now the company wants me to basically have two of these prices things.. they love the first one...they update it daily..and everything.. can i copy that code and use a different document..put it in as..price1.csv? and do it that way? they thought maybe i could do it as one document..but i know thats gonna add some coding LOL.
  3. well... i got everything pretty much under control. It is showing up completely properly. The only thing i cant figure out.. and maybe it was sumthing i did in the csv file.. is that the title variables.. like corn, soybeans, wheat, location, month's, all those.. they have quotation marks around them. I noticed u dont have them in yours. Simple resolution to that? Sry im being such a pain... but u have helped a TON...
  4. great! The csv thing...that worked AWESOME... i found out the parse error.. that i kept getting..it was the beginning header thing sayin it was an xml file or sumthing. cuz i deleted line one..where it had the error..and it worked good. BUT.. LOL.. [a href=\"http://www.falmouthfarmsupply.com/prices.php\" target=\"_blank\"]http://www.falmouthfarmsupply.com/prices.php[/a] i think its looking sorta wrong cuz i didnt lock anything in the excel doc. u said to lock everything but those one things in the image.. well.. i have no clue what ur talkin bout when u say that. ull have to clarify. sry im not so smart guys.. obviously why im here..in the newbie section. Im goin to Wright State U. this fall to start on my Computer Engineering Degree..maybe ill learn sumthing there. :P And id nvr heard of a csv file until today... kinda cool... and they are very small in size lol 357 bytes! Thanks for all ur help... u had to have worked alot on this if u got that much coding done .. unless u had the script already and jus tweaked it... id hope thats the case..thats a LONG script.
  5. [!--quoteo(post=364927:date=Apr 14 2006, 06:29 PM:name=litebearer)--][div class=\'quotetop\']QUOTE(litebearer @ Apr 14 2006, 06:29 PM) [snapback]364927[/snapback][/div][div class=\'quotemain\'][!--quotec--] Just my 2 cents. perferred method: create a Price Update form. they can access via their browser, verify the data and click ok. the script then takes the data and stores it in a database. when the main price page is accessed that script gets the data from the database and displays it properly. It really really is NOT as hard as it might seem. If you need further help ask. Lite... rather than a txt/doc file (which is very prone to creator errors) perhaps use an excel template in which they enter the data [/quote] If its not as hard as it seems.. then its still really hard LOL im very very new to PHP. I try to avoid it at all costs since i usually do simple sites, or photoshop sites..since im good with those. And i couldnt get the txt to show up still even with that updated code... um.. am i supposed to create a certain file with the PHP script in it??? cuz u said keep the txt in the same place as the php script.. the script is within the prices1.htm file..and the txt file is in the same folder as it.. so i thought i did it right. Correct me if im wrong.
  6. ok....the text file doesnt show up..but the page loads everything else...and yes..the doc. is FROM my computer..but it is with the rest of the stuff via ftp to the site. I have it linked correctly and everything. um.. here is all that is in this txt doc. Falmouth Location Month April May June July August Corn $0.00 $0.00 $0.00 $0.00 $0.00 Soybean $0.00 $0.00 $0.00 $0.00 $0.00 Wheat $0.00 $0.00 $0.00 $0.00 $0.00 This is how i have to have the prices of each thing laid out.. its for this site... www.falmouthfarmsupply.com If you go to the site..and click on grain prices...thats how it should look.. but that is all html.. on one page.. it would be easy for someone like ME to edit this html and change prices daily..but not for the ppl that are going to take care of this site. They need sumthing like a txt doc. that they can go in.. change the file, upload it..and not have to worry about learning html, or anything. And none of them have frontpage or anything so thats another reason i was recommended to just use a txt file. I have also been told this is bad practice 2 do... i should stay away from a txt file. I dont know.. i may be going about making this prices page all wrong.
  7. [!--quoteo(post=364657:date=Apr 13 2006, 10:14 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Apr 13 2006, 10:14 PM) [snapback]364657[/snapback][/div][div class=\'quotemain\'][!--quotec--] Depends on the exact format of your text file, but something like this might get you closer: [code]<?php $prices = file("pricesffs.txt");// read file into array for ($i=0;$i<count($prices)-1;$i++) {     echo $prices[$i]. "<br/>"; // echo each element of array }[/code] [/quote] didnt work... but was i supposed to end that code with ?> by chanced.. i tried with and without, but with no results. I guess its the txt document. but i didnt know there was different versions :S.
  8. Ok, im working on a website, and i have to do a grain prices page. I want this very simple as well 1. im not being paid much lol. and 2. I dont want it complicated. So my uncle explained to me to use [code]<?php require("pricesffs.txt"); ?>[/code] however, the txt does not show up or load or what not. Is the code right? btw, the site is [a href=\"http://www.falmouthfarmsupply.com\" target=\"_blank\"]http://www.falmouthfarmsupply.com[/a] its a simple site and i really need to get the prices page up and loaded right. The actual file im working with is [a href=\"http://www.falmouthfarmsupply.com/prices1.htm\" target=\"_blank\"]http://www.falmouthfarmsupply.com/prices1.htm[/a] which is not linked to the navigation yet. Im not going to link it until i get the txt doc. to load in the page. thanks for any help in advanced.. Patrick Best Indiana
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.