[Solved] How to simplify this php code [closed]

Try: <?php $include=””; if( in_array($day, array(‘Mon’, ‘Tue’, ‘Wed’, ‘Thu’, ‘Fri’) ) && ($hour >= 6 && $hour < 22) ) { $include = $detect->isMobile() ? ‘online_mobile’ : ‘online_desktop’; } if($day == ‘Sat’ && ($hour >= 8 && $hour < 18)) { $include = $detect->isMobile() ? ‘online_mobile’ : ‘online_desktop’; } if($day == ‘Sun’ && ($hour >= … Read more

[Solved] creating an instance in a for loop

dir() produces a sorted list of names; these are just strings. They are not references to the actual objects. You can’t apply a call to a string. Use the globals() dictionary instead, this gives you a mapping with both the names and the actual objects: for name, obj in globals().items(): if not name.startswith(‘__’): print “name … Read more

[Solved] database view creation issue

You should join two tables using ‘inner join’ and you have to use a ‘where’ condition. In where condition use ‘AND’ to check its the same person using the employee id and then sum the total working hours. solved database view creation issue

[Solved] I want to remove duplicate entries separated by commas from text area when form is submitted? [closed]

Use $array = explode(“,”,$string) then array_unique($array); and then $string = implode(“,”,$array) <?php $string = “10,12,10,15,12”;// Textarea value $array = explode(“,”,$string);// make string to array separated by comma `,` $array = array_unique($array); // remove duplicate from array $string = implode(“,”,$array); // again make array to string with comma `,` separated echo $string; ?> Live demo : … Read more

[Solved] C RPG game for my homework

Here are the issues in your code. First, as suggested in the comments, you don’t have to call srand on every iteration, just once upfront – that sets the random seed for your current program execution and here it is enough to do it once, int main() { srand(time(NULL)); Secondly, you’re using wrong symbols for … Read more

[Solved] I am trying to fetch data between date

I think it will be helpful for you. get the result from MYSQL table between two dates in php. try this code: <?php $con=mysqli_connect(“localhost”,”root”,””,”database_name”); $first_date=$_POST[“first_date”]; $second_date=$_POST[“second_date”]; $sql=mysqli_query($con,”SELECT * FROM `table_name` WHERE `date` BETWEEN ‘”.$first_date.”‘ AND ‘”.$second_date.”‘ “); ?> solved I am trying to fetch data between date

[Solved] How to split the name for student mark list

When you define the new variable, convert results$name to character, not results. Also, use ” ” (a blank space) to split the words, not “” (no space). If you fix that one line, the code seems to work. Change this: new=strsplit(as.character(results),””) to this: new=strsplit(as.character(results$name),” “) 0 solved How to split the name for student mark … Read more

[Solved] c++ objected oriented dictionary program [closed]

This excerpt of the error message is quite clear: In function `Dictionary::Dictionary()’: Dictionary.cpp: multiple definition of `Dictionary::Dictionary()’ main.cpp: first defined here You are defining the constructor of the Dictionary class twice – once in Dictionary.cpp and then again in Main.cpp. It is almost as if you are defining the constructor in the header file but … Read more

[Solved] Absurd output. Gives different output with and w/o debugging. Need expert intervention [duplicate]

Your construction invokes Undefined Behavior. See Undefined behavior in c/c++: i++ + ++i vs ++i + i++ and Why are these constructs (using ++) undefined behavior? #include<iostream> using namespace std; int main() { int i=2; //cout<<i++<<i<<i++<<i; // UB! cout<<i++; cout<<i; cout<<i++; cout<<i; return 0; } 1 solved Absurd output. Gives different output with and w/o … Read more

[Solved] How do you put words into a 3×3 grid using python [duplicate]

import random words = [“a”, “b”, “c”, “d”, “e”, “f”, “g”, “h”, “i”] random.shuffle(words) grouped = [words[i:i+3] for i in range(0, len(words), 3)] for l in grouped: print “”.join(“{:<10}”.format(x) for x in l) Output: e h b i c g a d f Remove the random.shuffle(words) line if you need the original a,b,c,d,etc order. solved … Read more