Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9066633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:46:14+00:00 2026-06-16T16:46:14+00:00

in my mysql database I have several rows each containing an item id. What

  • 0

in my mysql database I have several rows each containing an item id. What I would like to do is update each of the “placidRate” columns for what is contained within the XML document of the very large URL below. Example, for typeID 1230, it should find the rate of 1230 in my db and match it with the rate of $type->sell->min. That is the end goal. Right now all I’m looking for it to do is echo the old rate (db) and the new rate (xml) next to each other.

while($row = mysql_fetch_assoc($result)){
    $oldTypeID = $row['typeID'];

    $urlPlacid = 'http://api.eve-central.com/api/marketstat?typeid=1230&typeid=17470&typeid=17471&typeid=1228&typeid=17463&typeid=17464&typeid=1224&typeid=17459&typeid=18&typeid=17455&typeid=17456&typeid=1227&typeid=17867&typeid=17868&typeid=20&typeid=17452&typeid=17453&typeid=1226&typeid=17448&typeid=17449&typeid=1231&typeid=17444&typeid=17445&typeid=21&typeid=17440&typeid=17441&typeid=1229&typeid=17865&typeid=17866&typeid=1232&typeid=17436&typeid=17437&typeid=19&typeid=17466&typeid=17467&typeid=1225&typeid=17432&typeid=17433&typeid=1223&typeid=17428&typeid=17429&typeid=22&typeid=17425&typeid=17426&typeid=11396&typeid=17869&typeid=17870&typeid=34&typeid=35&typeid=36&typeid=37&typeid=38&typeid=40&typeid=39&typeid=11399&regionlimit=10000048';
    $xmlPlacid = simplexml_load_file($urlPlacid);
    foreach($xmlPlacid->marketstat->type as $type){
         $newRate = $type->sell->min;
         if($type[id] = $oldTypeID){
               echo "old placid rate: ".$row['placidRate']." || new placid rate: ".$newRate;
         }
    else{}

The problem with this code, is that it returns

old placid rate: 14.5 || new placid rate: 12.00old placid rate: 14.5 || new placid rate: 25.00old placid rate: 14.5 || new placid rate: 17.00old placid rate: 14.5 || new placid rate: 25.21old placid rate: 14.5 || new placid rate: 22.01old placid rate: 14.5 || new placid rate: 30.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 55.00old placid rate: 14.5 || new placid rate: 80.00old placid rate: 14.5 || new placid rate: 85.00old placid rate: 14.5 || new placid rate: 94.00old placid rate: 14.5 || new placid rate: 90.00old placid rate: 14.5 || new placid rate: 120.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 290.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 1087.06old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 0.00old placid rate: 14.5 || new placid rate: 4.00old placid rate: 14.5 || new placid rate: 10.00old placid rate: 14.5 || new placid rate: 40.00old placid rate: 14.5 || new placid rate: 143.00old placid rate: 14.5 || new placid rate: 819.00old placid rate: 14.5 || new placid rate: 2599.00old placid rate: 14.5 || new placid rate: 770.00old placid rate: 14.5 || new placid rate: 0.00

And I’m not entirely sure why…

One step closer to updating the sql table. edited once more

$market = new eveCentral();
while($row = mysql_fetch_assoc($result2)){
    $oldTypeID = $row['typeID'];
    $oldRate = $row['placidRate'];
    $newPlacidRate = $market->placidMin($oldTypeID);
    $newForgeRate = $market->forgeMin($oldTypeID);
    $newUniverseRate = $market->universeMin($oldTypeID);

    $updateQuery = "UPDATE itemRates SET placidRate = $newPlacidRate, forgeRate = $newForgeRate, universeRate = $newUniverseRate WHERE typeID = $oldTypeID";
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T16:46:15+00:00Added an answer on June 16, 2026 at 4:46 pm

    Apart from the problem with the wrong operator in the if comparison (as @GBD has outlined), you have a few issues here:

    1. You are fetching the XML from eve-central.com for each database result row. But the XML does not change. Move it above the database while query.
    2. As @Alex has answered, use xpath to locate the item with the ID you’re looking for.

    A view from above:

    $marketstat = new EveCentralMarketstat();
    
    while ($row = mysql_fetch_assoc($result)) {
        $oldTypeID = $row['typeID'];
        $oldRate   = $row['placidRate'];
        $newRate   = $marketstat->getSellMinByType($oldTypeID);
        if (FALSE !== $newRate) {
            echo "old placid rate: " . $oldRate . " || new placid rate: " . $newRate;
        }
    }
    

    Definition for the EveCentralMarketstat class:

    Add the functions you need for more data access, also the constructor can be improved depending on which information you need, just a quick outline how you can improve.

    /**
     * Wrapper Class for Even Central API Market Statistics
     */
    class EveCentralMarketstat
    {
        /**
         * @var SimpleXMLElement
         */
        private $xml;
    
        public function __construct() {
    
            $urlPlacid = 'http://api.eve-central.com/api/marketstat?typeid=1230&typeid=17470&typeid=17471&typeid=1228&typeid=17463&typeid=17464&typeid=1224&typeid=17459&typeid=18&typeid=17455&typeid=17456&typeid=1227&typeid=17867&typeid=17868&typeid=20&typeid=17452&typeid=17453&typeid=1226&typeid=17448&typeid=17449&typeid=1231&typeid=17444&typeid=17445&typeid=21&typeid=17440&typeid=17441&typeid=1229&typeid=17865&typeid=17866&typeid=1232&typeid=17436&typeid=17437&typeid=19&typeid=17466&typeid=17467&typeid=1225&typeid=17432&typeid=17433&typeid=1223&typeid=17428&typeid=17429&typeid=22&typeid=17425&typeid=17426&typeid=11396&typeid=17869&typeid=17870&typeid=34&typeid=35&typeid=36&typeid=37&typeid=38&typeid=40&typeid=39&typeid=11399&regionlimit=10000048';
            $this->xml = simplexml_load_file($urlPlacid);
        }
    
        /**
         * @param $typeID
         * @return bool|string String value if $typeID is found, FALSE on error
         */
        public function getSellMinByType($typeID) {
    
            $result = $this->xml->xpath("/*/marketstat/type[@id = '$typeID']/sell/min");
            if (!$result) {
                return FALSE;
            }
            return (string)$result[0];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several columns in a MySQL database that I would like to add
I have a large table (several million rows) in a MySQL (version 5.0) database
My mysql database has a table with several hundred thousand rows. Each row has
I have a database that has a collection of several rows with data like
I have a MySQL database that I am keeping temperature readings from several different
Let's say we have system A comprising a MySQL database, with several tables. After
I have mysql database like this id | code 1 | bok-1 2 |
I have mysql database structure like below: CREATE TABLE test ( id int(11) NOT
I have a MySQL database table t with just two columns, id which is
I have several classes that are basically interfaces to database rows. Since the class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.