Jump to content

Barand

Moderators
  • Content Count

    18,855
  • Joined

  • Last visited

  • Days Won

    346

Barand last won the day on January 16

Barand had the most liked content!

Community Reputation

1,248 Excellent

1 Follower

About Barand

  • Rank
    Sen . ( ile || sei )

Profile Information

Recent Profile Visitors

56,270 profile views
  1. We'll find out when I try to process it. [edit] I split the data you posted into lines of 3 values. You said 27 but there are 28 before it starts getting weird.
  2. Are those really spaces between each set of three values or are they linefeeds (\n)? HTML has a way treating all whitespace as a space.
  3. I still don't know what the data you are processing looks like. Unless, if you echo $highscores, it gives 123456(rank compared to all other players), 58(level of the skill), 1234567(total xp in skill),
  4. Barand

    Best approach guidance

    It's amazing the rubbish you can find using Google, but that's no excuse to propagate it here. mysql> select NOW(), RIGHT(CURRENT_TIMESTAMP, 5); +---------------------+-----------------------------+ | NOW() | RIGHT(CURRENT_TIMESTAMP, 5) | +---------------------+-----------------------------+ | 2019-01-23 16:00:46 | 00:46 | +---------------------+-----------------------------+ Why propose using the hrs:mins portion to calculate age - that's taking precision to ridiculous lengths. Try SELECT YEAR(CURRENT_DATE) - YEAR(dob) - ( RIGHT(CURRENT_DATE,5) < RIGHT(dob,5)) as age;
  5. Barand

    Best approach guidance

    That will find everyone who is less than 1 year old. Tell us what you are trying to do and we can tell you if there is a better implementation (which given what I just wrote about your suggested query, is almost certainly yes)
  6. To make the data you load useful yo need the skill and a date the scores applied. +------------+ +-------------+ | user | | skill | +------------+ +-------------+ | user_id(PK)|---+ +------| skill_id(PK)| | name | | | | description | | etc | | | +-------------+ +------------+ | +----------+ | | | score | | | +----------+ | +----<| user_id | | | skill_id |>--+ | rank | | level | | xp | | date | +----------+
  7. Strange there is nothing to say which of the 27 skills those numbers refer to. Do you want the text that is in (..) also writing to the csv or just the number value?
  8. function validate() isValid = true; if email is invalid set isValid = false if password is invalid set isValid = false if passwords do not match set isValid = false return isValid end
  9. Can you show us a sample portion of $highscores that you egt from the api call? A point on data design - you have the user's name in the user table. You should not be repeating it in every row of the data table, they should contain the user's id value as a foreign key instead.
  10. Barand

    Best approach guidance

    If you don't like the object notation (eg $result=$conn->query("SELECT foo FROM bar"); ) you can always write yourelf a set of procedural PDO functions so you call $result = pdo_query($conn, "SELECT foo FROM bar") instead. After all , that is all that MySqli does, and, like mysqli procedural versions, you will always have that overhead of the intermediate function call. function pdo_query(PDO $conn, $querystring) { return ($conn->query($querystring)); }
  11. Barand

    PDO double entries

    Below is the output from echo '<pre>', print_r($response, 1), '</pre>'; showing a cut-down version of your response array. All you need to do is step through the sequence of keys on the way down to the item you want.
  12. Barand

    PDO double entries

    The array flattening is just a waste of time and effort. Get the data from the multi-D array directly. It's not rocket science. $myarray = array( 'Page_id' => $i, //your database table column name => data you want to insert 'County' => $response['county'], 'Country' => $response['country'], 'Post_Town' => $response['listings'][0]['post_town'] );
  13. Barand

    PDO double entries

    It's on this page of the manual. Scroll down a bit to "Variadic functions"
  14. Barand

    PDO double entries

    That line is wrong. It is pushing an array on to the $values array. You need to push the individual values from the array, hence the "..." in array_push($values, ...array_values($myarray));
  15. Barand

    PDO double entries

    $db->exec("DROP TABLE IF EXISTS test2DB"); //<---- I GOT THE ERROR HERE $db->exec("CREATE TABLE test2DB (
×

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.