Jump to content

All Activity

This stream auto-updates     

  1. Today
  2. You are using the "keys" from the user submitted data as the field names in your query! DO NOT DO THIS! Never trust the data from the user. Just because you provided the field names in the form does not mean that the user will submit that back. The user could arbitrarily send any field names or even malicious SQL code to expose or corrupt your DB.
  3. Yesterday
  4. A checkbox is only submitted when it is checked. You cannot simply look at [0] and [1] and so on to know what value it has. The answer is, hopefully not too surprisingly, to look at the value. You've got it right there. fruit_selection will be an array and all you have to do is see if that array contains each fruit.
  5. Hello all, I am trying to learn OOP in PHP so please forgive my ignorance. I seem to be having difficulty inserting data into my database from checkbox items. My database has a column for each each fruit. I would like for each column to be populated with either a one(1) for checked or a zero(0) for not checked. Currently, my attempts have failed. I can either get all checkboxes to insert all zeros or I can get the first column to insert a one(1) while the others as zeros. Is there anybody here that can help me figure out what I am doing wrong and help me to re-work my code so I can get this to work? If anybody can help me using OOP methods that would be fantastic. Thank you all in advance. $preffruit->create_preffruit(array( 'fruit_apple' => escape(Input::get(['fruit_selection'][0]) ? 1 : 0), 'fruit_orange' => escape(Input::get(['fruit_selection'][1]) ? 1 : 0), 'fruit_banana' => escape(Input::get(['fruit_selection'][2]) ? 1 : 0), 'fruit_pear' => escape(Input::get(['fruit_selection'][3]) ? 1 : 0), 'fruit_kiwi' => escape(Input::get(['fruit_selection'][4]) ? 1 : 0) )); <input type="checkbox" name="fruit_selection[]" value="fruit_apple"> <input type="checkbox" name="fruit_selection[]" value="fruit_orange"> <input type="checkbox" name="fruit_selection[]" value="fruit_banana"> <input type="checkbox" name="fruit_selection[]" value="fruit_pear"> <input type="checkbox" name="fruit_selection[]" value="fruit_kiwi"> public function insert_preffruit($table, $fields = array()) { $keys = array_keys($fields); $values = ''; $x = 1; foreach($fields as $field) { $values .= '?'; if($x < count($fields)) { $values .= ', '; } $x++; } $sql = "INSERT INTO preffruit (`user_id`, `" . implode('`, `', $keys) . "`) VALUES (LAST_INSERT_ID(), {$values})"; if(!$this->query($sql, $fields)->error()) { return true; } return false; }
  6. Last week
  7. Probably a waste of time. If users with those IPs use a VPN you won't know where they are coming from anyway. If you properly harden your server and pages you don't have to worry much about hackers. If you want to keep certain users off your web site then use a login page and vet the user before permitting access.
  8. has anyone here ever seen these 2 sites? IP DENY https://www.ipdeny.com/ TOR EXIT NODES https://check.torproject.org/torbulkexitlist with regard to the former, the domain has one page per country I believe. so, you can get listings for like say, China and Russia on these 2 pages: China: https://www.ipdeny.com/ipblocks/data/countries/cn.zone Russia: https://www.ipdeny.com/ipblocks/data/countries/ru.zone my question to folks here is, would this information be useful to me? I am putting together some website content that I do not want everyone in the world to see. And, it is possible that by some miracle, the sophisticated hacker world outside the USA will want to take it down and/or disrupt the service offerings of it if they find out that it exists. Anyone got any advice on whether these resources are even worth the effort to use? and if they are, what is the best way to leverage them? e.g. - when pulling info from the server DB to display content on the page, check this IP data first to see who they are and whether I will allow them or block them? thanks. Adam @requinix, I know we've talked about blocking illegitimate traffic before. and I know you said I can't ever get rid of all of it. but this is new info that I've run across. Just wondering what you guys think of this. =)
  9. I immediately saw my issue as soon as i wrote the above. I was including head at the start of the register document rather than just above the html.
  10. Hmm, i am sure i am being very simple here but im not sure i follow. I have updated the code in my head.php to what is in the post above. Most of my other pages include head.php On my register page i have the following error: Register line 73 is: header("location: register.php?user_may_exist"); and head line 14 is the last line of this: <?php if(isset($currentPageTitle)){ $curPage = $currentPageTitle; }else{ $curPage = 'Baldock Town Cricket Club'; }; if(isset($currentPageMeta)){ $desc = "<meta name='description' content='$currentPageMeta'>"; }else{ $desc = "<meta name='description' content='All the latest from Baldock Town CC'>"; }; ?> <!DOCTYPE html>
  11. Yes, there will be some variables to output that were prepared in the php section, but any validation conditions requiring you to send a location header to another page will have occured before anything is sent to the browser in the html section.
  12. Do i not still have to include something after the html section? Like follows: <?php if(isset($currentPageTitle)){ $curPage = $currentPageTitle; }else{ $curPage = 'Cricket Club'; }; if(isset($currentPageMeta)){ $desc = "<meta name='description' content='$currentPageMeta'>"; }else{ $desc = "<meta name='description' content='All the latest from CC'>"; }; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title> <?= $curPage ?> </title> <?= $desc ?> <meta name="viewport" content="width=device-width, initial-scale=1.0">
  13. Simples! Do your php processing before the html section. <?php ?> <html> </html>
  14. Hi All, I am trying to use headers at the end of functions to put the user where they need to be. header("location: register.php?user_may_exist"); I understand how they work and their qwuirks. My issue is, in my head file, i am outputting which causes issues for the headers which come after. I have the following in head.php <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title> <?php if(isset($currentPageTitle)){ echo $currentPageTitle; }else{ echo 'Cricket Club'; }; ?> </title> <?php if(isset($currentPageMeta)){ echo "<meta name='description' content='$currentPageMeta'>"; }else{ echo "<meta name='description' content='All the latest from CC'>"; }; ?> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> Is there a better way for me to achieve this?
  15. Thanks all for this - opened the door a little for me
  16. I'm not sure there even is anything wrong. Not with the code. You know what this thing does, right? You feed it a nickname and the script looks for IP addresses it used, then for each of those it finds nicknames, then for each of those it finds IP addresses, and so on until it runs out of stuff. You searched for "Matej_Cizik"? Look in the database table yourself for that nickname. Does any of the data seem to be off? Then try searching according to the IP addresses you just found. Then those nicknames. Does it seem to be spiraling out of control?
  17. Since you have multiple queries, you don't indicate what 'it' is. Which query is returning the bogus data? As an aside you should not use '*' in a select. List only those columns you actually intend to use.
  18. Hello. I just inherited a game stats system but it's not working properly. I'm gonna post the entire script: <?php error_reporting(E_ERROR | E_WARNING | E_PARSE); $servername = "127.0.0.1"; $username = ""; $password = ""; $dbname = ""; $addresses = Array(); $nicknames = Array(); $servers = Array(); $times = Array(); $find_ip = $_GET["ip"]; $find_name = $_GET["nick"]; if(isset($_GET["format"])) { $format = $_GET["format"]; } else { $format = "include"; } $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { ReturnError("NO_CONNECTION"); } function ReturnError($error) { global $format; if($format == "mod") die("!DATA!ERROR:" .$error. "!DATA!"); else die("ERROR:" . $error); } function ReturnData($data) { global $format; if($format == "mod") die("!DATA!SUCCESS:" .$data. "!DATA!"); else die("SUCCESS:" .$data); } function GetServerIP() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) return $_SERVER['HTTP_CLIENT_IP']; else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) return $_SERVER['HTTP_X_FORWARDED_FOR']; else return $_SERVER['REMOTE_ADDR']; } function GetTimestamp() { $now = DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', '')); $now->format("m-d-Y H:i:s.u"); $local = $now->setTimeZone(new DateTimeZone('Europe/Prague')); return $local->getTimestamp(); } function GetFormatedTime() { $now = DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', '')); $now->format("m-d-Y H:i:s.u"); $local = $now->setTimeZone(new DateTimeZone('Europe/Prague')); return $local->format("Y-m-d H:i:s.u"); } function AddAddress($addr) { global $addresses; if(in_array($addr, $addresses, true)) { return false; } else { array_push($addresses, $addr); return true; } } function AddTime($time) { global $times; if(in_array($time, $times, true)) { return false; } else { array_push($times, $time); return true; } } function AddNickname($nick) { global $nicknames; if(in_array($nick, $nicknames, true)) { return false; } else { array_push($nicknames, $nick, true); return true; } } function AddServer($server) { global $servers; if(in_array($server, $servers, true)) { return false; } else { array_push($servers, $server, true); return true; } } function LookForIPs($ip) { global $conn; $sql = "SELECT * FROM `connections` WHERE `IP` = '".$ip."'"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { AddAddress($row["IP"]); AddServer($row["serverIP"]); AddTime(Array($row["datestamp"], $row["datestring"], $row["serverIP"])); if(AddNickname($row["nickname"]) && $row["nickname"] != "Player" && $row["nickname"] != "A_Edition_V2") { LookForNicknames($row["nickname"]); } } return true; } else { return false; } } function LookForNicknames($nick) { global $conn; $sql = "SELECT * FROM `connections` WHERE `nickname` LIKE '".$nick."'"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { AddNickname($row["nickname"]); AddServer($row["serverIP"]); AddTime(Array($row["datestamp"], $row["datestring"], $row["serverIP"])); if(AddAddress($row["IP"])) { LookForIPs($row["IP"]); } } return true; } else { return false; } } function SortTimes() { global $times; $good = false; while($good == false) { $good = true; for($i = 0; $i < count($times); $i++) { if($i+1 == count($times)) continue; if($times[$i][0] < $times[$i + 1][0]) { $tmp = $times[$i]; $times[$i] = $times[$i + 1]; $times[$i+1] = $tmp; $good = false; } } } } function GenerateLastSeenString($fromTime) { $time_now = GetTimestamp(); if($time_now < $fromTime) { return "N/A"; } if($fromTime == 0 || $fromTime =="") { return "N/A"; } $ss = $time_now - $fromTime; $seconds = $ss%60; $minutes = floor(($ss%3600)/60); $hours = floor(($ss%86400)/3600); $days = floor(($ss%2592000)/86400); $months = floor($ss/2592000); $str = ""; if($months != 0) { if($str != "") $str = $str . " "; if($days == 1) $str = $str . $months . " month"; else $str = $str . $months . " months"; } if($days != 0) { if($str != "") $str = $str . " "; if($days == 1) $str = $str . $days . " day"; else $str = $str . $days . " days"; } if($hours != 0) { if($str != "") $str = $str . " "; if($hours == 1) $str = $str . $hours . " hour"; else $str = $str . $hours . " hours"; } if($minutes != 0) { if($str != "") $str = $str . " "; if($minutes == 1) $str = $str . $minutes . " minute"; else $str = $str . $minutes . " minutes"; } if($seconds != 0) { if($str != "") $str = $str . " "; if($seconds == 1) $str = $str . $seconds . " second"; else $str = $str . $seconds . " seconds"; } return $str. " ago"; } function ClearResult($arr) { for($i = 0; $i < count($arr); $i++) { if(gettype($arr[$i]) == "boolean") { //echo "Found bool at $i"; array_splice($arr, $i, 1); } } return $arr; } function PrintArray($arr) { for($i = 0; $i < count($arr); $i++) { echo $arr[$i]; if($i + 1 != count($arr)) { echo ", "; } } } if($format == "mod") { LookForNicknames($find_name); LookForIPs($find_ip); $nicknames = ClearResult($nicknames); $addresses = ClearResult($addresses); $servers = ClearResult($servers); $conn->close(); /*if (!filter_var($find_ip, FILTER_VALIDATE_EMAIL) && $find_ip != "") { $find_ip = $addresses[0]; }*/ if($find_ip == "") { $find_ip = $addresses[0]; } if($find_ip == "") { $find_ip = "0.0.0.0"; } if(count($nicknames) == 0 && count($addresses) == 0) { ReturnError("NOT_FOUND"); } echo "!DATA!"; echo "Nicknames used: "; PrintArray($nicknames); echo "*-*"; echo "Total IPs used: "; echo count($addresses); echo "*-*"; echo "Location: "; echo file_get_contents("http://127.0.0.1/db/getlocation.php?ip=$find_ip"); echo "*-*"; echo "Connected: "; echo count($times); echo " times*-*"; SortTimes(); if(GetTimestamp() - $times[0][0] < 60 * 60) echo "Last seen: " . GenerateLastSeenString($times[1][0]) . "*-*"; else echo "Last seen: " . GenerateLastSeenString($times[0][0]) . "*-*"; echo "First seen: " . GenerateLastSeenString($times[count($times)-1][0]); echo "!DATA!"; } else if($format == "debug") { LookForNicknames($find_name); LookForIPs($find_ip); $nicknames = ClearResult($nicknames); $addresses = ClearResult($addresses); $servers = ClearResult($servers); $conn->close(); /*if (!filter_var($find_ip, FILTER_VALIDATE_EMAIL) && $find_ip != "") { $find_ip = $addresses[0]; }*/ if($find_ip == "") { $find_ip = $addresses[0]; } if($find_ip == "") { $find_ip = "0.0.0.0"; } if(count($nicknames) == 0 && count($addresses) == 0) { ReturnError("NOT_FOUND"); } echo "Nicknames used: "; PrintArray($nicknames); echo "<br>"; echo "IPs used: "; PrintArray($addresses); echo "<br>"; echo "Location: "; echo file_get_contents("http://127.0.0.1/db/getlocation.php?ip=$find_ip"); echo "<br>"; echo "Connected: "; echo count($times); echo " times<br>"; SortTimes(); echo "Last seen: " . GenerateLastSeenString($times[0][0]) . "<br>"; echo "First seen: " . GenerateLastSeenString($times[count($times)-1][0]) . "<br>"; echo $find_name; } ?> The problem is that for some nicknames it returns a proper output which should look like this: But sometimes it just returns lots and lots of data even if the nickname I ask for is unique enough: Here's how the database looks: I don't know what's wrong with the script because I'm a PHP beginner. If someone could take a look at it and tell me what's the issue I'd appreciate.
  19. Cool man. Ya that works. I was trying to see how much of it I could do using just SQL and PHPMyAdmin. Thanks!
  20. Hi It does do.. The problem is inside the foreach loop, i have put some echos and this is really strange, if you look my code you willsee a lot of echos to help me to debug if($haveDesdobramento === "1") { if ((isSegunda( $internal_date )) && !isExcludedDate( $internal_date )) { $cronograma[$this_month][] = $this_day; if($temposSegunda != null) { if ($haveDesdobramento === "1" && $haveAllClass === null) { if($totais<=$horasTurnos){ $t = $sum + $temposSegunda; if($t > $horasTurnos){ $n1 = abs($t - $horasTurnos); $temposSegunda = $temposSegunda - $n1; } if ($sameDayShifts === "1") { $cronograma[$this_month][] = $temposSegunda; $cronograma[$this_month][] = $temposSegunda; } else{ $cronograma[$this_month][] = $temposSegunda; $cronograma[$this_month][] = 0; $total += $temposSegunda; $cronograma[$this_month][] = $total; } } } if ($haveDesdobramento === "1" && $haveAllClass === "1") { echo "1ª Soma:".$sum; print "<br>"; if($sum<$horasAll){ echo "2ª Soma:".$sum; print "<br>"; if(($sum+ $temposSegunda) > $horasAll){ echo "3ª Soma:".($sum+ $temposSegunda); print "<br>"; $n1 = abs(($sum+ $temposSegunda) - $horasAll); $temposSegunda = $temposSegunda - $n1; print "<br>"; } if ($sameDayShifts === "1") { $cronograma[$this_month][] = $temposSegunda; $cronograma[$this_month][] = $temposSegunda; } else { echo "aqui 2"; print "<br>"; $cronograma[$this_month][] = $temposSegunda; $cronograma[$this_month][] = 0; $total += $temposSegunda; $cronograma[$this_month][] = $total; $sum += $temposSegunda; } } } else{ echo "aqui"; $days = floor($horas/$temposSegunda); $hours_remaining = $horas - $days * $temposSegunda; $cronograma[$this_month][] = $hours_remaining; } } } } And with all those debugs i'm receiving this 1ª Soma:0 2ª Soma:0 aqui 2 1ª Soma:3 2ª Soma:3 aqui 2 1ª Soma:6 2ª Soma:6 aqui 2 1ª Soma:9 2ª Soma:9 aqui 2 1ª Soma:12 2ª Soma:12 aqui 2 1ª Soma:15 2ª Soma:15 aqui 2 1ª Soma:18 2ª Soma:18 aqui 2 1ª Soma:21 2ª Soma:21 aqui 2 1ª Soma:24 2ª Soma:24 aqui 2 1ª Soma:27 2ª Soma:27 aqui 2 1ª Soma:30 2ª Soma:30 aqui 2 1ª Soma:33 2ª Soma:33 aqui 2 1ª Soma:36 2ª Soma:36 aqui 2 1ª Soma:39 2ª Soma:39 aqui 2 1ª Soma:42 2ª Soma:42 aqui 2 1ª Soma:45 2ª Soma:45 aqui 2 1ª Soma:48 2ª Soma:48 aqui 2 1ª Soma:51 2ª Soma:51 aqui 2 1ª Soma:54 2ª Soma:54 aqui 2 1ª Soma:57 2ª Soma:57 aqui 2 1ª Soma:60 2ª Soma:60 aqui 2 1ª Soma:63 2ª Soma:63 aqui 2 1ª Soma:66 2ª Soma:66 aqui 2 1ª Soma:69 2ª Soma:69 aqui 2 1ª Soma:72 2ª Soma:72 aqui 2 1ª Soma:75 2ª Soma:75 aqui 2 1ª Soma:78 2ª Soma:78 aqui 2 1ª Soma:81 2ª Soma:81 aqui 2 1ª Soma:84 2ª Soma:84 aqui 2 1ª Soma:87 2ª Soma:87 aqui 2 1ª Soma:90 2ª Soma:90 aqui 2 1ª Soma:93 2ª Soma:93 aqui 2 1ª Soma:96 2ª Soma:96 aqui 2 1ª Soma:99 2ª Soma:99 3ª Soma:102 aqui 2 1ª Soma:100 1ª Soma:100 And the array is created i have this (last 3 lines) 2021-06-07 - 3 - 0 - 99 2021-06-14 - 1 - 0 - 100 2021-06-21 - 1 - 0 - 100 same in 2 differents dates but i have reached the 100 (hours) in first date (2021-06-14) I don't understand why this last line Thanks
  21. Add this before the 'foreach' to make sure it does what you expect. echo "<pre>"; print_r(range( 0, $datediff )); echo "</pre>"; The errors are likely related. Which lines are 661 and 670?
  22. Hello I'm having problems regarding coding right the following problem One class (students) can have class all together or/and divided (haveDesdobramento) into 2 shifts So in the beginning i'm choosing all class and defined 100 hours Using a foreach because i need to check holidays, school breaks, start and end of school foreach (range( 0, $datediff ) as $day) { $internal_date = date( INTERNAL_FORMAT, strtotime( "{$startDate} + {$day} days" ) ); $this_day = date( INTERNAL_FORMAT, strtotime( $internal_date ) ); $this_month = date( INTERNAL_FORMAT, strtotime( $internal_date ) ); if($haveDesdobramento === "1") { if ((isSegunda( $internal_date )) && !isExcludedDate( $internal_date )) { $cronograma[$this_month][] = $this_day; if($temposSegunda != null) { if($sum>=$horasAll){ $nhoras = $sum - $horasAll; $temposSegunda = $temposSegunda - $nhoras; echo "tSegunda: ".$temposSegunda; } if ($haveDesdobramento === "1" && $haveAllClass === null) { if($totais<=$horasTurnos){ if ($sameDayShifts === "1") { $cronograma[$this_month][] = $temposSegunda; $cronograma[$this_month][] = $temposSegunda; } else{ $days = floor($horas/$temposSegunda); $hours_remaining = $horas - $days * $temposSegunda; $cronograma[$this_month][] = $hours_remaining; } } } if ($haveDesdobramento === "1" && $haveAllClass === "1") { if($sum<=$horasAll){ if ($sameDayShifts === "1") { $cronograma[$this_month][] = $temposSegunda; $cronograma[$this_month][] = $temposSegunda; } else { $cronograma[$this_month][] = $temposSegunda; $cronograma[$this_month][] = 0; $total += $temposSegunda; $cronograma[$this_month][] = $total; } } } else{ $days = floor($horas/$temposSegunda); $hours_remaining = $horas - $days * $temposSegunda; $cronograma[$this_month][] = $hours_remaining; } } $sum += $temposSegunda; } } It works but it stops at 102, not 100 like it should (choosing 3 hours each time) and the array returned gives me this Any help? Thanks 2021-06-07 - 3 - 0 - 99 2021-06-14 - 3 - 0 - 102 Notice: Undefined offset: 1 in /home/esmaior/public_html/miga/db/crud/profissionais/response.php on line 661 2021-06-21 - - 0 - 102 Notice: Undefined offset: 1 in /home/esmaior/public_html/miga/db/crud/profissionais/response.php on line 670 Notice: Undefined offset: 1 in /home/esmaior/public_html/miga/db/crud/profissionais/response.php on line 661 2021-06-28 - - 0 - 102 Notice: Undefined offset: 1 in /home/esmaior/public_html/miga/db/crud/profissionais/response.php on line 670 Total: 102
  23. Perhaps ## ## create a test table ## $db->exec("CREATE TABLE IF NOT EXISTS production_status ( id int not null auto_increment primary key, submit_time datetime ) "); ## ## randomly add 1,000 records for last 2 months ## $data = []; for ($i=0; $i < 1000; $i++) { $r = rand(1, 60); $dt = date('Y-m-d H:i:s', strtotime("-$r days")); $data[] = "('$dt')"; } $db->exec("INSERT INTO production_status (submit_time) VALUES " . join(',', $data)); ## ## Now the bit you need ## $start_date = date('Y-m-d', strtotime('first day of this month')); $res = $db->prepare("SELECT date_format(submit_time, '%a %d-%b-%y') as date , COUNT(*) as total FROM production_status WHERE date(submit_time) >= ? GROUP BY date ORDER BY submit_time "); $res->execute([ $start_date ]); RESULTS +---------------+-------+ | date | total | +---------------+-------+ | Tue 01-Sep-20 | 14 | | Wed 02-Sep-20 | 24 | | Thu 03-Sep-20 | 15 | | Fri 04-Sep-20 | 21 | | Sat 05-Sep-20 | 15 | | Sun 06-Sep-20 | 24 | | Mon 07-Sep-20 | 17 | | Tue 08-Sep-20 | 17 | | Wed 09-Sep-20 | 15 | | Thu 10-Sep-20 | 11 | | Fri 11-Sep-20 | 15 | | Sat 12-Sep-20 | 16 | | Sun 13-Sep-20 | 13 | | Mon 14-Sep-20 | 11 | | Tue 15-Sep-20 | 21 | | Wed 16-Sep-20 | 21 | | Thu 17-Sep-20 | 15 | | Fri 18-Sep-20 | 17 | | Sat 19-Sep-20 | 17 | | Sun 20-Sep-20 | 14 | +---------------+-------+
  24. Here is my query so far: SELECT DISTINCT (SELECT COUNT(id) FROM :TABLE WHERE CAST(submit_time AS DATE) = CURDATE() - INTERVAL 7 DAY AND user_id = 7) AS Monday, (SELECT COUNT(id) FROM :TABLE WHERE CAST(submit_time AS DATE) = CURDATE() - INTERVAL 6 DAY AND user_id = 7) AS Tuesday, (SELECT COUNT(id) FROM :TABLE WHERE CAST(submit_time AS DATE) = CURDATE() - INTERVAL 5 DAY AND user_id = 7) AS Wednesday, (SELECT COUNT(id) FROM :TABLE WHERE CAST(submit_time AS DATE) = CURDATE() - INTERVAL 4 DAY AND user_id = 7) AS Thursday, (SELECT COUNT(id) FROM :TABLE WHERE CAST(submit_time AS DATE) = CURDATE() - INTERVAL 3 DAY AND user_id = 7) AS Friday, (SELECT COUNT(id) FROM :TABLE WHERE CAST(submit_time AS DATE) = CURDATE() - INTERVAL 2 DAY AND user_id = 7) AS Saturday, (SELECT COUNT(id) FROM :TABLE WHERE CAST(submit_time AS DATE) = CURDATE() - INTERVAL 1 DAY AND user_id = 7) AS Sunday FROM :TABLE ps WHERE ps.user_id = :USER The results it is giving me are all wrong so I'm not sure what I am doing wrong. I'm new to using views but I created a few this morning to help me quickly analyze certain data. I want to use the graphing feature in PhpMyAdmin more. What I'd like to be able to do is have a view that shows how many records were entered into the production_status table by the user for each day of the last week; or even better each day of this month and then chart it on a bar graph.
  25. Programming isn't like piecing together LEGO blocks. You can't just go onto the internet and get an "admin dashboard" component and shove it into your application. If you're working with WordPress or some other cookie-cutter framework then there might be a plugin out there to do what you want. Otherwise you'll probably have to (gasp) learn some PHP and HTML and CSS. Because it's not like there are people out there who know your website and are climbing over each other to write free stuff that will work with it in the hopes that you'll go download their thing.
  26. Oh not quite, in this case I am talking about a dashboard where users or myself can see their stats, profile, etc.
  1. Load more activity
×
×
  • 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.