Jump to content

php4ever

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

php4ever's Achievements

Member

Member (2/5)

0

Reputation

  1. I posted it here; http://livedemosite.com/fixcsv/testing_full.php If you run the script, it just duplicates the output in a loop of some sort. The idea behind the above script is to take that nasty CSV file and fix the text data by removing all those extra breaks and html code. I know it now works properly for formatting because looking at the 2 left columns I see the main ID and the secondary ID consistently. What doesn't work, is it keeps looping. You can for instance open your FireFox, hit CTRL+F and search for 3966497 and you will see that the output has been produced again and again. There are 200 rows in the CSV, none are the same.
  2. Ok here you go // the column-array.php is just the array matching that in the data.csv. require_once("column-array.php"); $fp = fopen("data.csv", "r"); // getZip not used this version function getZip($full) { $pieces = explode(' ', $full); $zip = explode('(', $pieces[count($pieces)-1]); $zip = explode(')', $zip[1]); return $zip[0]; } $pre=""; while (($data = fgets($fp,4096)) !== FALSE) { $data=str_replace("\r\n","",$data); if(trim($data)=="" or substr($data,strlen($data)-1,1)!='"' or substr($data,strlen($data)-2,2)==',"') { $pre.=$data; } else { $data=$pre.$data; $data=str_replace(array(',""','","','"',"'","html","\r\n"),array("","|","","","PHP"," "),$data); $data=preg_replace("/\r|\n|\v|\r\n/smUi"," ",$data); $data_elements=explode("|",$data); } //////////////////////////////////////////////////////////////////////////// // USED TO ECHO FIELD COLUMNS IN A TABLE - Used For Testing Output //////////////////////////////////////////////////////////////////////////// echo("<table border=2 cellpadding=5 cellspacing=5>"); $i++; echo("<tr>"); foreach($data_elements as $k) { echo("<td valign=top width='20' style='overflow:hidden;'>"); echo($k); echo("</td>"); } echo("</tr>"); echo("</table>"); continue; $listings++; //} } fclose($fp);
  3. I have a script that opens up a CSV file and outputs to a table for testing. It ultimately inserts into a MySQL but the code below literally duplicates every third row consistently. I'm 95% sure its in the "WHILE" area. Is there enough code here for someone to point out an error. If not I can put the code up live and if you want a fee for fixing just PM me please. $fp = fopen("residential-data.csv", "r"); $listings=-1; function getZip($full) { $pieces = explode(' ', $full); $zip = explode('(', $pieces[count($pieces)-1]); $zip = explode(')', $zip[1]); return $zip[0]; } $pre=""; while (($data = fgets($fp,4096)) !== FALSE) { $data=str_replace("\r\n","",$data); if(trim($data)=="" or substr($data,strlen($data)-1,1)!='"' or substr($data,strlen($data)-2,2)==',"') { $pre.=$data; }
  4. Thats nice, it doesn't appear to allow me to redistribute the app I'm creating. If I have all the tables in an HTML, is it over complex to have someone just code this or is it rather involved?
  5. I have three small tables and I'm looking for a clean, light, framework CRUD generator that I can use. Are there any that are small and light that dont require a full blown install like Symphony or phpObject Generator etc... Jared
  6. Thanks you, I need to add links to the videos describing the project. I hope that is okay to do as well.
  7. Is it okay to post projects for hire in here? I have about a dozen small tasks I need done. Jared
  8. With ACCESS or Jet databases that have a nice way to create joins and relationships making everything super lean is exceptionally easy to understand for the most part. With MySQL this would require a ton of PHP coding to keep them together when it comes to searches and such so I want to create all data in larger tables to accommodate more fields as opposed to breaking up each field element into multiple rows. Is this a better way to build such a DB. ID | Date | Expiration | TTD | LBC | (then) 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 etc and so on. In table 2 I would have 1 Name 2 City 3 State 4 Country 5 Donation 6 TaxID Does that seem like a logical way to make the DB extensible enough to change yet keep performance super tight?
×
×
  • 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.