Jump to content

manhattes

Members
  • Content Count

    88
  • Joined

  • Last visited

Community Reputation

0 Neutral

About manhattes

  • Rank
    Regular Member
  1. Jacques1 Advanced Member 1,770 posts Posted Yesterday, 10:23 PM INSERT IGNORE with Link being a primary or unique key. Like This Best Answer Quote MultiQuote Thanks. Changed the row value to primary.
  2. I fixed it by just keeping my code and assigning the row as a primary. thanks!
  3. Something like IF Link NOT EXIST INSERT....
  4. What do you mean do a query for link? How can I do the query for an incoming link before its in the table?
  5. sorry that issue was solved and it led to this question. wasn't sure of protocol.
  6. The script pulls in the last 1000 results of a feed and sometimes if it updates within the 1000 results there are duplicates. The column that has the link is the best way to identify the row as a duplicate so if I already have it then I dont need to save it....
  7. I am reading an RSS feed and sometimes I pull in duplicates of data. $citable= "INSERT INTO TableName (Company, Form, Date, Link) VALUES ('" . $FnumI ."',' " . $Form ."','" . $msqldate ."','" . $Flink ."') ON DUPLICATE KEY UPDATE Company='" . $FnumI ."', Form='" . $Form ."', Date='" . $msqldate ."', Link='" . $Flink ."'"; Is there a way I can only record the data if Link does not exist?
  8. Thanks it is slow but worked. my script pulls in an RSS feed and sometimes pulls in data that was already pulled in. $citable= "INSERT INTO TableName (Company, Form, Date, Link) VALUES ('" . $FnumI ."',' " . $Form ."','" . $msqldate ."','" . $Flink ."') ON DUPLICATE KEY UPDATE Company='" . $FnumI ."', Form='" . $Form ."', Date='" . $msqldate ."', Link='" . $Flink ."'"; Is there a way I can only record the data if Link does not exist? Yes there is always an id.
  9. I am trying to delete all the rows that have a duplicate URL in my table. I tried this code: but it is giving me an error: You can't specify target table 'TableName' for update in FROM clause DELETE FROM TableName WHERE ID NOT IN (SELECT MAX(ID) FROM TableName GROUP BY Link HAVING MAX(ID) IS NOT NULL)
  10. I am trying to read an RSS feed and the way my code is written, it is only repeating the first result. the xml looks like this: <?xml version="1.0" encoding="ISO-8859-1" ?> <feed xmlns="http://www.w3.org/2005/Atom"> <title>Latest Filings - Thu, 18 Feb 2016 14:52:36 EST</title> <link rel="alternate" href="/cgi-bin/browse-edgar?action=getcurrent"/> <link rel="self" href="/cgi-bin/browse-edgar?action=getcurrent"/> <id>http://www.sec.gov/cgi-bin/browse-edgar?action=getcurrent</id> <author><name>Webmaster</name><email>webmaster@sec.gov</email></author> <updated>2016-02-18T14:52:36-05:00</updated> <entry> <title>4 - YABUKI JEFFERY W (0001207371) (Reporting)</title> <link rel="alternate" type="text/html" href="http://www.sec.gov/Archives/edgar/data/1207371/000120919116099734/0001209191-16-099734-index.htm"/> <summary type="html"> <b>Filed:</b> 2016-02-18 <b>AccNo:</b> 0001209191-16-099734 <b>Size:</b> 13 KB </summary> <updated>2016-02-18T14:51:18-05:00</updated> <category scheme="http://www.sec.gov/" label="form type" term="4"/> <id>urn:tag:sec.gov,2008:accession-number=0001209191-16-099734</id> </entry> <entry> <title>4 - FISERV INC (0000798354) (Issuer)</title> <link rel="alternate" type="text/html" href="http://www.sec.gov/Archives/edgar/data/798354/000120919116099734/0001209191-16-099734-index.htm"/> <summary type="html"> <b>Filed:</b> 2016-02-18 <b>AccNo:</b> 0001209191-16-099734 <b>Size:</b> 13 KB </summary> <updated>2016-02-18T14:51:18-05:00</updated> <category scheme="http://www.sec.gov/" label="form type" term="4"/> <id>urn:tag:sec.gov,2008:accession-number=0001209191-16-099734</id> and my code is like this: $context = stream_context_create(array('http' => array('header' => 'Accept: application/xml'))); $url = 'http://www.sec.gov/cgi-bin/browse-edgar?action=getcurrent&CIK=&type=4&company=&dateb=&owner=include&start=100&count=20&output=atom'; $xml = file_get_contents($url, false,$context); $xml = simplexml_load_string($xml); print_r($xml); foreach ($xml->entry as $entry){ $FnumI=$xml->entry->title; //$FnumC=$xml->entry->title; $Fdate=$xml->entry->updated; $Flink=$xml->entry->link->attributes()->href; $Form=$xml->entry->category->attributes()->term; echo "<tr>"; echo "<td><p>".$FnumI."</p></td>"; //echo "<td><p>".$FnumC."</p></td>"; echo "<td><p>".$Fdate."</p></td>"; echo "<td><p><a href='".$Flink."'> ". $Flink."</p></td>"; echo "<td><p>".$Form."</p></td>"; echo "</tr>"; }
  11. I have 2 tables Table1 is names,addresses,phone Table2 has other info that i want including the names In table2 the names are in a cell grouped together like this: James Madison|University of Iowa|Jeff Hall What is the best way to join the table since there is no exact match? Is it a str_search or something?
  12. I imported a table into mysql and the dates within the table are formatted "16-Feb" where the 16 is the Year not the day. Day has no value. I tried to convert it in excel first but it kept switching the day with the year. Which command should i use to format the dates properly within SQL?
  13. I can no longer open the table after I ran this query and it appeared to run correctly. :-( $query2 = "UPDATE ". $symbol ." b INNER JOIN CleanedCalendar a ON a.BuyDate = b.Date SET a.CalDatePrice = b.Close";
  14. Little background on the DB Table1 is CleanedCalendar Table2 is $symbol (there is a symbol table for each symbol which has 1 entry per day making Date a unique column) I want to set the column CalDatePrice = to the price in the symbol table on the matched date.
  15. Still doesnt work. $symbol is only letters with no spaces
×
×
  • 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.