Jump to content

Barand

Moderators
  • Posts

    24,605
  • Joined

  • Last visited

  • Days Won

    830

Everything posted by Barand

  1. perhaps +-------------+ | chart | +-------------+ +-------------+ | +---------------+ | series | | | category | +-------------+ | +---------------+ | | | | /|\ | | +-------------+ | +-------------<| value |>--------------+ +-------------+
  2. So if your categories are the continents then you could have a chart showing population growth, say, but you could not then have another chart for those continents showing economic growth.
  3. According to that model, a chart can have many categories but a category can belong to only one chart.
  4. The idea is to "USE databasename" to set the correct database name as default
  5. I can think of only three ways Only ever have a single database on your server Execute the statement "USE databasename" before every query. In INSERT, UPDATE and DELETE queries always prefix the table names with dbname (ie dbname.tablename). No damage is done with SELECT queries I suppose a fourth way is be careful what you are doing
  6. Use "SELECT DISTINCT ... " You seem to have design flaws in the database. If the table contains the id and name then they should be unique. If, on the other hand, it's a table at the "many" end of a one-to-many relationship then the name shouldn't be in the table, just the id.
  7. see https://en.wikipedia.org/wiki/Phrases_from_The_Hitchhiker%27s_Guide_to_the_Galaxy#Answer_to_the_Ultimate_Question_of_Life.2C_the_Universe.2C_and_Everything_.2842.29
  8. You might want to consider altering the logic of the program so that if there are no results to display then you do not even attempt to paginate nothing.
  9. Something I've already told them in another post (http://forums.phpfreaks.com/topic/301723-error-saving-data-in-mysql-table/). Why do we bother?
  10. HTML colours have three colour components, namely red, green and blue. Each of these has a value ranging from 0 to 255. These are expressed as hexadecimal values 00 to FF. #FF0000 = red #00FF00 = green #0000FF = blue equal quantities of each component gives a grey color, for example #888888 gives a mid-grey. In the function, the variables $r, $g and $b are the red, green and blue values. Those look fairly meaningful to me, better than $peter, $paul and $mary.
  11. Having got the data into a CSV file you can load it into a MySql table using LOAD DATA INFILE statement
  12. Not throwing an error does not mean it works. It removes the characters from the text fields also It still leaves commas in the currency field
  13. @requinix - It was tricky getting the timing just right
  14. try $sql = "SELECT co.id , co.name , car.id , car.model FROM companytest co INNER JOIN cartest car ON co.id = car.make ORDER BY co.id, car.id"; $res = $db->query($sql); $cars = []; $prev = ''; while (list($coid, $coname, $cid, $model) = $res->fetch_row()) { if (!isset($cars[$coid])) { $cars[$coid] = ['id' => $coid, 'name' => $coname, 'cars' =>[] ]; } $cars[$coid]['cars'][] = ['id' => $cid, 'model' => $model]; } the data mysql> select * from companytest; +------+----------------+ | id | name | +------+----------------+ | 1 | Ford | | 3 | General Motors | | 5 | Chrysler | +------+----------------+ 3 rows in set (0.00 sec) mysql> select * from cartest; +------+------+------------+ | id | make | model | +------+------+------------+ | 1 | 1 | Mustang | | 2 | 1 | Fusion | | 3 | 3 | Corvette | | 4 | 3 | Escalade | | 5 | 5 | Charger | | 6 | 5 | Challenger | +------+------+------------+ 6 rows in set (0.00 sec)
  15. Do you have error reporting turned on? Have you checked the values of mysqli_error? I cannot do it for you.
  16. Similarly, the code you just posted, the input to simplexml_load_string() is $result->GetDailyListingSummaryResult->any That should be the XML.
  17. First step to debugging is to have error_reporting switched on and also check for mysqli_error values after attempting queries. Where is $resultat defined? If it isn't it should be throwing an "undefined variable" error.
  18. Your data shows team as character field, yet you create a table with team name as INT and goals as varchar(). As this table contains only one field for goals, and you say you want both a count and a total, which goes in the new table (count or total). And why are you doing this at all? You can get these by query any time, you should not store data derived from the data in databases.
  19. That is NOT xml, it is a var dump output of some xml data that has been processed by simplexml.
  20. Can you describe what is is you are trying to do so I can make some sense of your code.
  21. You might want to test that solution before you go any further
  22. Consider this scenario. You have the following statuses 1 - not started 2 - work in progress 3 - completed. So now, anything not completed has "status < 3" and all works well with your query. You boss now tells you they are introducing new status codes 4 - temporarily on hold. 5 - cancelled status < 3 no longer gives you all those that are not completed.
  23. Make sure your bind_param() has the params in the same order as the placeholders in the query
×
×
  • 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.