267 Posted Topics

Member Avatar for Plinth

Python will teach you to write a readable code also because the program code syntax is based on deviations

Member Avatar for diafol
0
512
Member Avatar for Himanshu Chawla

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

Member Avatar for AndrisP
0
355
Member Avatar for Peter_56
Member Avatar for Bacchus_1

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;

Member Avatar for Web-Designer
0
1K
Member Avatar for shivya_1

Do not use table name in apostrophes! Table name can be in the backticks.

Member Avatar for cereal
0
315
Member Avatar for Petreanu

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 …

Member Avatar for AndrisP
0
319
Member Avatar for Siberian

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" …

Member Avatar for Siberian
0
704
Member Avatar for phphp

In line 4 form action change to <form name="form" action="<?php echo filter_input(INPUT_SERVER, 'PHP_SELF'); ?>" method="post">

Member Avatar for AndrisP
0
215
Member Avatar for UI

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 …

Member Avatar for AndrisP
0
409
Member Avatar for shivya_1

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 …

Member Avatar for inthewind
0
406
Member Avatar for Jimmy_8

`<body onload="document.all.sendform.submit();">` but watch out - if form action will be self address then it raise endless loop

Member Avatar for AndrisP
0
495
Member Avatar for UI

Try `CURLOPT_RETURNTRANSFER`instead of `RETURNTRANSFER` http://php.net/manual/en/function.curl-setopt.php

Member Avatar for cereal
0
1K
Member Avatar for Daron_1

It seems your trigger working fine ![Screenshot.png](/attachments/large/4/a2fb230d2decde1a99060dcf5e7e093f.png "align-center")

Member Avatar for AndrisP
0
214
Member Avatar for moh_2
Member Avatar for rproffitt
0
321
Member Avatar for UI

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( …

Member Avatar for UI
0
345
Member Avatar for Venus_3
Member Avatar for Justin Kent

Each "else if" is unclosed brackets. "for" is closed. "if" inside "for" is closed. But "else if" mis-matched

Member Avatar for JamesCherrill
0
630
Member Avatar for SARDEN

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

Member Avatar for AndrisP
0
475
Member Avatar for Siberian

"Map network drive" if you are windows user, or open network folder and then save bookmark if you are linux user.

Member Avatar for rproffitt
0
1K
Member Avatar for Dani

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 …

Member Avatar for Geek-Master
0
420
Member Avatar for AndrisP

What has gone wrong with DaniWeb? It is no longer normal usable on the Ubuntu Phone.

Member Avatar for rproffitt
0
492
Member Avatar for k_manimuthu

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 …

Member Avatar for diafol
0
556
Member Avatar for vitaquous

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`, …

Member Avatar for rubberman
0
310
Member Avatar for Siberian
Member Avatar for Siberian
0
898
Member Avatar for Siberian

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 …

Member Avatar for Siberian
0
494
Member Avatar for AndrisP

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" …

Member Avatar for AndrisP
0
829
Member Avatar for mldardy
Member Avatar for lolafuertes
0
348
Member Avatar for Brian_22

... or use bitwise operator `if(i&1)` if true even else odd. Its faster because compare one bit only without mathematics

Member Avatar for rubberman
0
541
Member Avatar for nathan_8

You cannot set combined primary key `CONSTRAINT SCREEN_PK PRIMARY KEY(BRANCHID,SCREENID)` The unique index may combine two (or more) fields eg `UNIQUE(BRANCHID,SCREENID)`

Member Avatar for Alec_2
0
491
Member Avatar for Aeonix

Your pattern checked only first character. Change to: `(!preg_match("/^[0-9a-zA-Z ]+$/", $name3))`

Member Avatar for pritaeas
0
393
Member Avatar for phphp
Member Avatar for Greg_15
Member Avatar for AndrisP
0
330
Member Avatar for Muhammad_122

#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; }

Member Avatar for rubberman
-1
457
Member Avatar for Acu Ci Dbuggerz
Member Avatar for Dani
0
535
Member Avatar for zebnoon1

Raed this topic https://www.daniweb.com/programming/web-development/threads/505941/insert-user-details-with-photo-into-database#post2209304

Member Avatar for diafol
0
409
Member Avatar for Baran_1
Member Avatar for centenond

Use brackets when you combine multiple `AND OR` conditions eg WHERE `aprove` = 1 AND (`descripcion` LIKE '%$search%' OR `nombre` LIKE '%$search%')

Member Avatar for AndrisP
0
157
Member Avatar for Stefce

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

Member Avatar for diafol
0
2K
Member Avatar for Stefce

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

Member Avatar for Stefce
0
333
Member Avatar for kingwash

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

Member Avatar for AndrisP
0
357
Member Avatar for Amaina

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 …

Member Avatar for Amaina
0
497
Member Avatar for שנהב

It is not good idea because your db_select() function make new connection on each query

Member Avatar for JamesCherrill
0
5K
Member Avatar for Erik_8

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 …

Member Avatar for AndrisP
0
432
Member Avatar for SubratPHP

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']) …

Member Avatar for jkon
0
844
Member Avatar for Samantha Joy

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

Member Avatar for Avinash_8
0
240
Member Avatar for mitchell.schols
Member Avatar for mitchell.schols
0
180
Member Avatar for zelrick
Member Avatar for Karthik_4

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

Member Avatar for Karthik_4
0
13K
Member Avatar for sahilmohile15

`$_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

Member Avatar for madCoder
0
294
Member Avatar for du_ebrithil

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]]`

Member Avatar for AndrisP
0
267

The End.