Jump to content

Barand

Moderators
  • Content Count

    19,007
  • 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,644 profile views
  1. 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
  2. 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 | | ... | ... | ... | ... |
  3. 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)
  4. 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)
  5. Barand

    Creating Google Charts with dynamic data

    We've got out sync. My line 35 hasn't got one of those.
  6. Nobody noticed, honest!
  7. You have single quotes arond "time" so it is being treated as a string literal. Use backticks like you have around the previous one.
  8. Barand

    Creating Google Charts with dynamic data

    Try deleting line 36 and then reentering it in case there's a hidden character lurking.
  9. 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; }
  10. 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
  11. Barand

    Creating Google Charts with dynamic data

    Post your nameOptions function that is giving the error.
  12. Barand

    Creating Google Charts with dynamic data

    Have you got a missing ";" at the end of line 36?
  13. Barand

    stored procedure for php pdo login

    Do you already have a "validateUser" procedure? If so, try DROP procedure IF EXISTS `validateUser`; DELIMITER $$ CREATE PROCEDURE `validateUser`(user varchar(30)) BEGIN SELECT id, username, password FROM user_account WHERE username = user; END$$ DELIMITER ;
  14. Copy that query and execute it in phpMyAdmin. I am sorry we can't do it for you.
  15. Barand

    stored procedure for php pdo login

    What is the whole error message?
×

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.