Jump to content

Barand

Moderators
  • Content Count

    19,011
  • Joined

  • Last visited

  • Days Won

    357

Barand last won the day on March 20

Barand had the most liked content!

Community Reputation

1,267 Excellent

2 Followers

About Barand

  • Rank
    Sen . ( ile || sei )

Profile Information

Recent Profile Visitors

56,646 profile views
  1. That appears to be a far cry from the problem that you posted. I see you are starting a table subquery with "join (". What I can't see is a ") aliasname" where the subquery ends.
  2. try SELECT partgroup , partid , quantity , total , round(quantity / q12 * 100, 2) as pcent FROM part JOIN ( SELECT partgroup , quantity as q12 FROM part WHERE RIGHT(partid,2) = '12' ) as p12 USING (partgroup);
  3. Barand

    Says

    Have you connected to the database server? And is that connection $mysqli?
  4. Barand

    Help needed with PHP 5.6 Umlaut Problem

    Steps Make sure your database charset is utf8 (check tables and individual columns are not overriding the default) Make sure your db connection is utf8 with a Latin1 connection I get "Name: �bermann" with utf8 connection I get "Name: Übermann" Make sure you html is using utf-8
  5. The time column in your db table needs to be DATETIME type and not INT. You also need to change your query so you have ... WHERE `time` BETWEEN = '2019-03-20 00:00:00' AND '2019-03-20 23:59:00' instead of using 1553040000 and 1553126340
  6. Barand

    import csv in mysql db using ajax and php

    - Now you have impoerted your data you should nomalize the data, so you would have +---------------+ +---------------+ | student | | subject | +---------------+ +---------------+ | student_id |---+ +-----| subject_id | | name | | +---------------+ | | name | | etc | | | score | | +---------------+ +---------------+ | +---------------+ | +---<| student_id | | | subject_id |>---+ | score | | exam_date | +---------------| and the data in those tables would look like this +-----+----------+ +-------------+----------------+---------+-----------------+ +--------------+-----------------+ | Id | name | | student_id | subject_id | score | exam_date | | subject_id | name | +-----+----------+ +-------------+----------------+---------+-----------------+ +--------------+-----------------+ | 1 | Name1 | | 1 | 1 | 10 | 2019-03-01 | | 1 | Physics | | 2 | Name2 | | 1 | 2 | 25 | 2019-03-01 | | 1 | Maths | +-----+----------+ | 1 | 3 | 35 | 2019-03-01 | | 1 | Chemistry | | 2 | 1 | 80 | 2019-03-01 | | | | | 2 | 2 | 45 | 2019-03-01 | | 3 | 3 | 45 | 2019-03-01 | | ... | ... | ... | ... |
  7. Barand

    Do you have a pet?

    A good idea. You still get your exercise and the dog gets out and about to experience all the local scents (his daily newspaper)
  8. I see your philosophy is "Why use one function when the job can be done with four" Examples: $end = strtotime(date('M')." ".date('d').", ".date('Y')." 11:59pm"); // is equivalent to $end = mktime(23,59,0); if (cal_days_in_month(CAL_GREGORIAN, date('m'), date('Y')) == 31) { $array = array('01' => 0 ,'02' => 0 ,'03' => 0 ,'04' => 0 ,'05' => 0 ,'06' => 0 ,'07' => 0 ,'08' => 0 ,'09' => 0 ,'10' => 0 ,'11' => 0 ,'12' => 0 ,'13' => 0 ,'14' => 0 ,'15' => 0 ,'16' => 0 ,'17' => 0 ,'18' => 0 ,'19' => 0 ,'20' => 0 ,'21' => 0 ,'22' => 0 ,'23' => 0,'24' => 0 ,'25' => 0 ,'26' => 0 ,'27' => 0 ,'28' => 0 ,'29' => 0 ,'30' => 0 ,'31' => 0); }elseif (cal_days_in_month(CAL_GREGORIAN, date('m'), date('Y')) == 30) { $array = array('01' => 0 ,'02' => 0 ,'03' => 0 ,'04' => 0 ,'05' => 0 ,'06' => 0 ,'07' => 0 ,'08' => 0 ,'09' => 0 ,'10' => 0 ,'11' => 0 ,'12' => 0 ,'13' => 0 ,'14' => 0 ,'15' => 0 ,'16' => 0 ,'17' => 0 ,'18' => 0 ,'19' => 0 ,'20' => 0 ,'21' => 0 ,'22' => 0 ,'23' => 0,'24' => 0 ,'25' => 0 ,'26' => 0 ,'27' => 0 ,'28' => 0 ,'29' => 0 ,'30' => 0); }elseif (cal_days_in_month(CAL_GREGORIAN, date('m'), date('Y')) == 29) { $array = array('01' => 0 ,'02' => 0 ,'03' => 0 ,'04' => 0 ,'05' => 0 ,'06' => 0 ,'07' => 0 ,'08' => 0 ,'09' => 0 ,'10' => 0 ,'11' => 0 ,'12' => 0 ,'13' => 0 ,'14' => 0 ,'15' => 0 ,'16' => 0 ,'17' => 0 ,'18' => 0 ,'19' => 0 ,'20' => 0 ,'21' => 0 ,'22' => 0 ,'23' => 0,'24' => 0 ,'25' => 0 ,'26' => 0 ,'27' => 0 ,'28' => 0 ,'29' => 0); }elseif (cal_days_in_month(CAL_GREGORIAN, date('m'), date('Y')) == 28) { $array = array('01' => 0 ,'02' => 0 ,'03' => 0 ,'04' => 0 ,'05' => 0 ,'06' => 0 ,'07' => 0 ,'08' => 0 ,'09' => 0 ,'10' => 0 ,'11' => 0 ,'12' => 0 ,'13' => 0 ,'14' => 0 ,'15' => 0 ,'16' => 0 ,'17' => 0 ,'18' => 0 ,'19' => 0 ,'20' => 0 ,'21' => 0 ,'22' => 0 ,'23' => 0,'24' => 0 ,'25' => 0 ,'26' => 0 ,'27' => 0 ,'28' => 0); } // is equivalent to $array = array_fill_keys(range(1, date('t')), 0); Stop using unix style timestamps and use MySQL datetime formats. (Y-m-d H:i:s)
  9. Barand

    Creating Google Charts with dynamic data

    We've got out sync. My line 35 hasn't got one of those.
  10. You have single quotes arond "time" so it is being treated as a string literal. Use backticks like you have around the previous one.
  11. Barand

    Creating Google Charts with dynamic data

    Try deleting line 36 and then reentering it in case there's a hidden character lurking.
  12. Barand

    Creating Google Charts with dynamic data

    Here's the relevant bit <?php define("HOST",'localhost'); define("USERNAME",'????'); define("PASSWORD",'????'); define("DATABASE", "????"); function pdoConnect() { $dsn = "mysql:dbname=".DATABASE."; host=".HOST."; charset=utf8"; $db = new pdo($dsn, USERNAME, PASSWORD, [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, ]); return $db; }
  13. Barand

    stored procedure for php pdo login

    The single quotes were actually backticks, but as validateUser isn't a reserved SQL keyword they are optional. Also the IN appears to be optional with MySql but I cannot vouch for MariaDB
  14. Barand

    Creating Google Charts with dynamic data

    Post your nameOptions function that is giving the error.
×

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.