[Solved] php date change to 12 hour format and add gmt +3 [closed]

[ad_1] If you want the GMT +3 timezone, you could apply this: date_default_timezone_set(‘Etc/GMT+3′); Although I don’t recommend it because PHP will not longer support that timezone. You might use one of the supported ones. And for the date being in 12-hour format use it this way: $date = date(‘m-d-Y h:i:s’); Lowercase h format character is … Read more

[Solved] Multiple Checkboxes

[ad_1] $name = $_POST[‘name’]; $email_body =”; <?php $aDoor = $_POST[‘formDoor’]; if(empty($aDoor)) { $email_body = “You didn’t select any buildings.”; } else { $N = count($aDoor); $email_body .= “You selected $N door(s): “; for($i=0; $i < $N; $i++) { $email_body .= $aDoor[$i] . ” “; } } ?> 0 [ad_2] solved Multiple Checkboxes

[Solved] PHP: INSERT array to table with a timer or clock (per second)

[ad_1] With javascript setInterval() method calls a function at specified intervals (in milliseconds). var pause = setInterval(function(){ insert data }, 2000); // 2 sec To stop the time use clearInterval(pause) by referencing the variable. To execute the function once use setTimeout() 0 [ad_2] solved PHP: INSERT array to table with a timer or clock (per … Read more

[Solved] Display Username in Index page

[ad_1] CheckLogin.php if ( $count == 1 ) { $_SESSION[‘login_id’] = $row[‘id’]; $_SESSION[‘username’] = $row[‘username’]; // added if ( $_SESSION[‘login_id’] != ” || $_SESSION[‘login_id’] > 0 ) { // edited header(“location: index.php”); } else { header(“location: login3.html”); } } Index.php <?php require_once ‘UserSessionAdmin.php’; // edited $username = $_SESSION[‘username’]; // added ?> <!DOCTYPE html PUBLIC “-//W3C//DTD … Read more

[Solved] Writing a function in laravel

[ad_1] You’re really missing out on the best parts of Laravel’s query builder. public function jobsearch(Request $request) { // htmlspecialchars makes no sense here $keyword = $request->input(‘keyword’); $city_id = $request->input(‘city_id’); $category_id = $request->input(‘category_id’); $query = DB::table(‘job_details’); if($keyword) { $query->where(‘job_title’, ‘like’, ‘%’.$keyword.’%’); } if($city_id) { $query->where(‘city_id’, $city_id); } if($category_id) { $query->where(‘category_id’, $category_id); } $results = $query->get(); … Read more

[Solved] Limit text length and putting read more button

[ad_1] You can limit the length of $row[‘newscontent’] with the substr function echo substr($row[‘newscontent’], 0, 199); There are various hang-ups that you should be aware of though: it will take 200 characters, it doesn’t handle multibyte strings well (utf-8 etc) and if your newscontent contains markup, it will likely be broken 1 [ad_2] solved Limit … Read more

[Solved] SELECT COUNT(DISTINCT column) doesn’t work

[ad_1] The distinct keyword is supposed to be outside like below, SELECT DISTINCT column1, column2, … FROM table_name; ? Also, you are trying to sum few things, It should be something like below, SELECT UID, COUNT(UID) AS TOTAL, SUM(CASE WHEN SYSTEM = ‘Android’ THEN 1 ELSE 0 END) AS A, SUM(CASE WHEN SYSTEM = ‘IOS’ … Read more

[Solved] Redirection not happening in Php [duplicate]

[ad_1] You can’t output prior to redirection. Either move the location redirect logic prior to output or you can add ob_start(); as the first line in your script and then that output will get discarded upon redirect. 1 [ad_2] solved Redirection not happening in Php [duplicate]

[Solved] How to wait until the ajax command finished in JavaScript?

[ad_1] You has called xmlhttp.open(“GET”, “yearselectionchanged.php?q=” + value, true); But the last param would be false, like this: xmlhttp.open(“GET”, “yearselectionchanged.php?q=” + value, false); True is a async request, then your code does not wait for response. And False is sync, your code will wait for response. See the documentation here: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Synchronous_and_Asynchronous_Requests#Synchronous_request 4 [ad_2] solved How … Read more

[Solved] How to put multiple parameters in one $ [closed]

[ad_1] It’s not JS, . will not sum up numbers, but convert it to string $d = $a . $b . $c; Please note, that you are working with float numbers, so sometimes instead of 1200.00 you can get 1199.999999999999999999998 and outputting it will trim your .00 part. That’s why you need to use number_format() … Read more

[Solved] Output an array in alphabetical order [closed]

[ad_1] You can try $group = array_reduce($data, function($a,$b) { $a[$b[‘surname’]{0}][] = $b; return $a; } ); ksort($group); foreach($group as $id => $data) { printf(“<h4>%s</h4>\n”,$id); foreach($data as $name) { printf(“%s %s\n”,$name[‘name’],$name[‘surname’]); } } Output <h4>B</h4> Bill Buffalo <h4>D</h4> John Doe Mark Doe See Full Demo 1 [ad_2] solved Output an array in alphabetical order [closed]