267 Posted Topics
Re: Python will teach you to write a readable code also because the program code syntax is based on deviations ![]() | |
Re: Do you really want to multiply the date difference by salary? Everything else can be done more extensively without subqueries and without `case when` using simple `IFNULL()` function SELECT EmpId, Emp_Name, Salary , Start_date , End_date , DATEDIFF( IFNULL(End_date, DATE_ADD(Start_Date, INTERVAL 30 DAY)) ,Start_Date ), Salary/30 as 'Total_Salary' from Employees | |
Re: Querie (line 13) is out of `foreach` (lines 9-11) | |
Re: select e.`name`, ( select group_concat( (select s.`shop` from `shops` s where s.`shop_id` = t.`shop_id`) separator ' ') from `shop_employees` t where t.`employee_id` = e.`id` ) `shop list` from `employees` e; | |
Re: Do not use table name in apostrophes! Table name can be in the backticks. | |
Re: Show your table creat SQL code. I do not know what primary or unique keys is set to the table. Example if unique key is person_id INSERT INTO ".$DB_TABLE." (`person_id`, `distanta` , `durata` , `start` , `end` ) VALUES(? , ? , ? , ? , ?) ON DUPLICATE KEY … | |
Re: All masks you need define in to <defs>. You can combine black and white filled masks to get hole or any other figure e.g. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 500 200"> <defs> <mask id="mask_1"> <circle cx="100" cy="100" r="30" fill="white" … | |
Re: In line 4 form action change to <form name="form" action="<?php echo filter_input(INPUT_SERVER, 'PHP_SELF'); ?>" method="post"> | |
Re: Also you can create array: <?php $numbers[] = "one"; $numbers[] = "two"; $numbers[] = "three"; $numbers[] = "four"; $numbers[] = "five"; ?> it works same as: <?php $numbers[0] = "one"; $numbers[1] = "two"; $numbers[2] = "three"; $numbers[3] = "four"; $numbers[4] = "five"; ?> ... and another method to create array … | |
Re: 1. First step - check your input parameters, e.g. in line 10 put: `print_r($_POST); exit();` 2. Second step - allways use backticks for all parameter names - it will protect you from conflicts to MySQL reserved names and others (read @diafol comment) 3. Third step - I strongly recommend use … ![]() | |
Re: `<body onload="document.all.sendform.submit();">` but watch out - if form action will be self address then it raise endless loop | |
Re: Try `CURLOPT_RETURNTRANSFER`instead of `RETURNTRANSFER` http://php.net/manual/en/function.curl-setopt.php | |
Re: It seems your trigger working fine  | |
Re: I recommend you use `filter_input()` or `filter_input_array()` function e.g. $args = array( 'member_registration_username' => array( 'filter' => FILTER_SANITIZE_STRING ), 'member_registration_password' => array( 'filter' => FILTER_SANITIZE_STRING ), 'member_registration_password_confirmation' => array( 'filter' => FILTER_SANITIZE_STRING ), 'member_registration_forename' => array( 'filter' => FILTER_SANITIZE_STRING ), 'member_registration_surname' => array( 'filter' => FILTER_SANITIZE_STRING ), 'member_registration_gender' => array( … | |
Re: How mutch `TEMPLATE_ID = 106 ` is in your subquery? | |
Re: Each "else if" is unclosed brackets. "for" is closed. "if" inside "for" is closed. But "else if" mis-matched | |
Re: File "insert_pdo": 1. Use `filter_input` http://php.net/manual/en/function.filter-input.php instead of `$email = $_POST['email'];` and `$checkbox = $_POST['checkbox'];` 2. `bindParam()` and `execute()` is missing after the prepare statement http://php.net/manual/en/pdostatement.bindparam.php | |
Re: "Map network drive" if you are windows user, or open network folder and then save bookmark if you are linux user. | |
Re: You can create stored procedure eg delimiter $$ drop procedure if exists `check_before_insert`$$ create procedure `check_before_insert`( in p_param_1 varchar(30) ,in p_param_2 varchar(30) ,in p_param_3 varchar(30) ) begin declare v_exists boolean default false; select t.`p_field_1` = p_param_1 into v_exists from `some_table` t where t.`p_field_2` = p_param_2; if v_exists = false then … ![]() | |
What has gone wrong with DaniWeb? It is no longer normal usable on the Ubuntu Phone. | |
Re: In to the subquery you can select `max(sales) group by Division` then `select * from SAMPLE where product not in (subquery)` eg select t.* from `sample` t where t.`product` not in ( select s.`product` from ( select m.`product` ,max(m.`sales`) from `sample` m group by m.`Division` ) s ) order by … ![]() | |
Re: You don't need use subqueries select a.`p_ID` ,a.`p_fName` ,a.`p_mName` ,a.`p_lName` ,b.`a_ID` ,b.`a_street` ,b.`a_box` ,b.`a_city` ,c.`c_ID` ,c.`c_name` ,c.`c_city` from `personTb` a inner join `personAddress` b on b.`p_ID` = a.`p_ID` inner join `personChurch` c on c.`p_ID` = a.`p_ID` ; or select concat_ws(' ', a.`p_fName`, a.`p_mName`, a.`p_lName`) as p_Name ,concat_ws(' ', b.`a_street`, b.`a_box`, … | |
Re: You can drav small circle eg <circle r=".5" cx="73.3" cy="73.1" fill="black" /> | |
Re: if you declare variable outside a function (before declare function) then you can access and change it inside eg var someVariable; function someFunction(){ someVariable = 5; } alert(someVariable); // undefined someFunction(); alert(someVariable); // 5 but if you redeclare variable with same name inside a function then it's a local variable … | |
How i can `sed` save pattern matches to variables and do something with it? eg $ echo "string_4.3.2" | sed 's/^string_\([0-9]\)\.\([0-9]\)\.\([0-9]\)$/\1 \2 \3/' output "4 3 2" but I want to pass variables to function eg do_something() { echo $1 echo $2 echo $3 # ..... # ..... } string="string_4.3.2" … | |
Re: begin insert into your_table .... exception when dup_val_on_index then update your_table... end; | |
Re: ... or use bitwise operator `if(i&1)` if true even else odd. Its faster because compare one bit only without mathematics | |
Re: Your pattern checked only first character. Change to: `(!preg_match("/^[0-9a-zA-Z ]+$/", $name3))` | |
Re: "array" need passing as reference to function "selectionSort" | |
Re: #include <stdio.h> int main(){ int i,s=8; while(s<=100){ printf("\t%d\n", s); switch(i){ case 4: i+=1; break; case 5: i+=2; break; default: i=4; } s+=i; } return 0; } | |
Re: You have a form inside another form - may not correctly treated by browser | |
Re: Raed this topic https://www.daniweb.com/programming/web-development/threads/505941/insert-user-details-with-photo-into-database#post2209304 ![]() | |
Re: Your code works properly on Ubuntu 16.04 compiled by CodeBlocks IDE 13.12 | |
Re: Use brackets when you combine multiple `AND OR` conditions eg WHERE `aprove` = 1 AND (`descripcion` LIKE '%$search%' OR `nombre` LIKE '%$search%') | |
Re: Make DB table for categories and another table for brends with foreigh keys constraints referenced to categories and another table for models with constraints referenced to brends ![]() | |
Re: You can use http://www.w3schools.com/tags/tag_details.asp <?php function makeList(array $Array) { $Output = '<details>'; foreach($Array as $Key => $Value) { if(is_array($Value)) { $Output .= '<summary>'.$Key.'</summary>'; $Output .= makeList($Value); } else { $Output .= '<div><a name="'.$Value.'" href="#">'.$Value.'</a></div>'; } } $Output .= '</details>'; return $Output; } ?> but is'n't supported on IE | |
Re: MySQL is deprecated http://php.net/manual/en/function.mysql-query.php use MySQLi instead http://php.net/manual/en/book.mysqli.php or PDO http://php.net/manual/en/class.pdo.php . For BLOB upload you can use http://php.net/manual/en/mysqli-stmt.send-long-data.php | |
Re: Two similar function for different year is irrationally. I would suggest to transform `getYear()` and put year as parameter eg `getYear($year)`. You can set many parameters eg `getYear($year, $page, $refs)` you can set default values also eg `getYear($year=date("Y"), $page=0, $refs=20)` then replace your query $year = filter_input(INPUT_GET, 'year', FILTER_VALIDATE_INT); $page … | |
Re: It is not good idea because your db_select() function make new connection on each query | |
Re: And you can use attribute "required" for all required fields in a form such as: <input type="email" name="email" width="20" required="required" /> HTML5 input type "email" is supported. if you use this type then client web browser check input email address before data form send to server. On the server side … | |
Re: For first: $id = $_GET['id']; $action = $_GET['action']; is not good practice! It raise PHP error if not set. All request variables initialize like this: $id = ( isset($_GET['id']) ? $_GET['id'] : '' ); "isset($action)" in to the line 9 is senseless, check it while initialize $action = ( isset($_GET['action']) … | |
Re: Try this: <?php $num=array(rand(), rand(), rand(), rand(), rand()); for($i=0;$i<5;$i++) echo '<input type="number" value="'.$num[$i].'">'; ?> Your array is empty | |
Re: Both order is valid but attribute "alt" is necessary for valid "img" tag | |
Re: You can put all in a shell script file e.g. "run_py_files.sh" /full/path/to/python/a.py /full/path/to/python/b.py /full/path/to/python/c.py /full/path/to/python/d.py /full/path/to/python/e.py /full/path/to/python/f.py /full/path/to/python/g.py make it executable and call only one shell script | |
Re: `$_SESSION['SBUser']` is session variable. You can set it if session is started see http://php.net/manual/en/book.session.php and dont put PHP variables directly to the SQL query! $query = $db->query("SELECT * FROM users WHERE id = '$user_id'"); replace to $stmt = $db->prepare("SELECT * FROM users WHERE id = ?"); $stmt->bind_param('i', $user_id); $stmt->execute(); http://php.net/manual/en/mysqli-stmt.bind-param.php | |
Re: Missed comma between arrays `var array = [[1,2,3][4,5,6][3,6,7]]` replace to `var array = [[1,2,3],[4,5,6],[3,6,7]]` |
The End.