AndrisP 193 Posting Pro in Training

Check your trash size

AndrisP 193 Posting Pro in Training

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

AndrisP 193 Posting Pro in Training

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

AndrisP 193 Posting Pro in Training

@Gribouillis Actually no its easy way to call python scripts from shell script file. Versions of Python declare in a .py file starts like #!/usr/bin/python or #!/usr/bin/python3 or other

AndrisP 193 Posting Pro in Training

You dont need python command. Make shell script executable and python scripts executable.
e.g. if you put in terminal cd /full/path/to/python "Enter" and then put a.py "Enter" then do not work but if shell record starts by slash like /full/path/to/python/a.py then it call as executable file

AndrisP 193 Posting Pro in Training

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

AndrisP 193 Posting Pro in Training

and don't put php variables directly in to the SQL query use bind_param instead http://php.net/manual/en/mysqli-stmt.prepare.php

AndrisP 193 Posting Pro in Training

SVG example ("width" and "height" similar to "viewBox"):

<?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" 
        version="1.1" width="150" height="150" 
        viewBox="0 0 150 150">
    <rect x="0" y="0" width="150" height="150" 
            fill="#FFFFAA" opacity="1" />
    <circle r="20" cx="75" cy="75" fill="none" 
            stroke="#000088" stroke-width="3" />
    <rect x="60" y="60" width="30" height="30" 
            fill="#888888" opacity="1" />
</svg>

if you change "width" and "height" of SVG then image zoom to new width and height:

<?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" 
        version="1.1" width="450" height="450" 
        viewBox="0 0 150 150">
    <rect x="0" y="0" width="150" height="150" 
            fill="#FFFFAA" opacity="1" />
    <circle r="20" cx="75" cy="75" fill="none" 
            stroke="#000088" stroke-width="3" />
    <rect x="60" y="60" width="30" height="30" 
            fill="#888888" opacity="1" />
</svg>

but if you change "viewBox" then image crop:

<?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" 
        version="1.1" width="150" height="150" 
        viewBox="50 50 50 50">
    <rect x="0" y="0" width="150" height="150" 
            fill="#FFFFAA" opacity="1" />
    <circle r="20" cx="75" cy="75" fill="none" 
            stroke="#000088" stroke-width="3" />
    <rect x="60" y="60" width="30" height="30" 
            fill="#888888" opacity="1" />
</svg>
AndrisP 193 Posting Pro in Training

In your example you trying send to server two variables by same name. I think more convenient is array of checkboxes with binary step values e.g.

<form action="" method="post"> 
<input type="checkbox" id="status_1" name="status[]" value="1" />
<input type="checkbox" id="status_2" name="status[]" value="2" />
<input type="checkbox" id="status_3" name="status[]" value="4" />
<input type="submit" />
</form>

then on the server side you get value as sum of array e.g.

$status = ( isset($_POST['status']) ? array_sum($_POST['status']) : 0 );

and then compare as binary e.g.

if($status & 1){ /* statement for option 1 */ }
if($status & 2){ /* statement for option 2 */ }
if($status & 4){ /* statement for option 3 */ }
AndrisP 193 Posting Pro in Training

If you replace to print recursive then you can see structure of the generated XML object

<!DOCTYPE html>
<html>
<body>
    <pre>
<?php
$xml=simplexml_load_file("demo.xml")
        or die("Error: Cannot create object");
print_r($xml);
?>
    </pre>
</body>
</html>

do with it what you want e.g. "foreach"

AndrisP 193 Posting Pro in Training

For first check your patch cable - connection 10mbps or 100mbps used 2 pairs only (4pin) but 1000mbps used all 4 pairs (8pin) and very important that all eight would be in the correct order!

AndrisP 193 Posting Pro in Training

Your mistake is concatenate simbol before first string "||"

AndrisP 193 Posting Pro in Training

You can create stored procedure like this:

DELIMITER $$
DROP PROCEDURE IF EXISTS `dinamic_update`$$
CREATE PROCEDURE `dinamic_update`(
    IN p_lang_name VARCHAR(30),
    IN p_ent_id  INT,
    IN p_new_value VARCHAR(30)
) BEGIN
SELECT `lang_code` INTO @v_lang_code 
    FROM `tbl_lang` WHERE `lang_name` = p_lang_name;
SET @sql_text = CONCAT('UPDATE `tbl_unicode` SET '
    , @v_lang_code, ' = \'', p_new_value
    , '\' WHERE `ent_id` = ', p_ent_id);
    PREPARE stmt FROM @sql_text;
    EXECUTE stmt;
    DEALLOCATE PREPARE stmt;
END; $$
DELIMITER ;

and then call it e.g.

CALL `dinamic_update`('Français', 1, 'new value for Français');
CALL `dinamic_update`('Deutsche', 1, 'new value for Deutsche');
AndrisP 193 Posting Pro in Training

I think you need RIGHT JOIN something like this:

DROP TABLE IF EXISTS `products`;
CREATE TABLE `products`(
    `prod_id` INT PRIMARY KEY
    ,`prod_name` VARCHAR(30)
    ,`prod_descr` VARCHAR(90)
    ,`prod_price` DECIMAL(7,2)
    ,`prod_stock` INT
    ,`prod_date` DATE
);
DROP TABLE IF EXISTS `wish_list`;
CREATE TABLE `wish_list`(
    `wish_id` INT PRIMARY KEY
    ,`wish_account` INT
    ,`wish_item_id` INT
    ,`wish_date` DATE
);
INSERT INTO `products`(
    `prod_id`
    ,`prod_name`
    ,`prod_descr`
    ,`prod_price`
    ,`prod_stock`
    ,`prod_date`)
VALUES (16575
    ,'Product One'
    ,'This is the first product!'
    ,10,2,'2016-03-20')
    ,(573552
    ,'Product Two'
    ,'This is the second product!'
    ,5,20,'2016-03-20');
INSERT INTO `wish_list`(
    `wish_id`
    ,`wish_account`
    ,`wish_item_id`
    ,`wish_date`)
VALUES (25745735
    ,54246326
    ,16575
    ,'2016-02-29')
, (265734573
    ,54246326
    ,3143
    ,'2016-02-29');
CREATE OR REPLACE VIEW `exp_result` AS
    SELECT w.`wish_id`, w.`wish_account`
    , w.`wish_item_id`, w.`wish_date`
    , p.`prod_id`, p.`prod_name`
    , p.`prod_descr`, p.`prod_price`
    , p.`prod_stock`, p.`prod_date` 
FROM `products` p
    RIGHT JOIN `wish_list` w
    ON p.`prod_id` = w.`wish_item_id`;
SELECT * FROM `exp_result`;
AndrisP 193 Posting Pro in Training

I think NULLIF(settlement, 0) IS NULL is better than settlement < 0.01 or settlement IS NULL
Try this:

SELECT * FROM settlement WHERE NULLIF(settlement, 0) IS NULL
AndrisP 193 Posting Pro in Training
  1. Function "indexOf()" returns number not boolean. If not found "-1" else position "0" or higher
  2. Search string is argument: "string".indexOf("ring") return "2", but "ring".indexOf("string") return "-1"
AndrisP 193 Posting Pro in Training

If problem is solved then mark thread as solved

AndrisP 193 Posting Pro in Training
CREATE TABLE `test_table`(
    `id` INT NOT NULL AUTO_INCREMENT,
    `data` DATE,
    `ip` VARCHAR(30),
    PRIMARY KEY (`id`)
);

DELIMITER $$
DROP PROCEDURE IF EXISTS insert_data; $$
CREATE PROCEDURE insert_data(IN p_cur INT, IN p_max INT)
BEGIN
    TRUNCATE TABLE `test_table`;
    START TRANSACTION;
    WHILE p_cur <= p_max do
        INSERT INTO `test_table`(`id`, `data`,`ip`) VALUES (p_cur, NOW(), '192.168.0.1');
        SET p_cur = p_cur + 1;
    END WHILE;
    COMMIT;
END; $$
DELIMITER ;
CALL insert_data(1,1000);
AndrisP 193 Posting Pro in Training
<?php
$selectedSizes = ( isset($_POST[size]) ? implode(",", $_POST[size]) : "" );
$sql = "SELECT * FROM `your_table_name` t WHERE FIND_IN_SET(t.`size_field`, ?)";
// then bind param $selectedSizes and execute query
?>
AndrisP 193 Posting Pro in Training

In HTML5 you can validate this without JS. If you change input type text to input type tel and input type email. Use attribute pattern for vaidate input type tel e.g.

<input type="tel" pattern="^[0-9]{8}$" />

Input type email you can use without pattern

AndrisP 193 Posting Pro in Training

You can change

<form enctype='multipart/form-data' id = "myform"> <input type='submit' value='Basic search' onclick="i2b2.BLAST.jsFunction()">

to

<form enctype="multipart/form-data" id="myform" onsubmit="i2b2.BLAST.jsFunction(); return false;"> <input type="submit" value="Basic search" >

then your function call when user press enter on any input field (same as submit button)

AndrisP 193 Posting Pro in Training

Replace "getElementByClassName" to "getElementsByClassName"

AndrisP 193 Posting Pro in Training

if you want insert:

INSERT INTO tablename (col1, col2, col3) VALUES (?,?,?)

if you want update table:

UPDATE tablename SET col1 = ? , col2 = ? , col3 = ? WHERE id = ?

your example contain illegal mix of sql commands.
And do not directly put variables into SQL, use prepare and execute statement!

AndrisP 193 Posting Pro in Training

You can use RLIKE instead:

SELECT 'sun' RLIKE '^sun[^shine]*$';
SELECT 'sunshine' RLIKE '^sun[^shine]*$';

or use word boundaries:

SELECT 'long text contain sun and other words' RLIKE '[[:<:]]sun[[:>:]]';
SELECT 'long text contain sunshine and other words' RLIKE '[[:<:]]sun[[:>:]]';
diafol commented: Good stuff on RLIKE :) +15
AndrisP 193 Posting Pro in Training

Line 35 return object and then you pass object in next query line 38

AndrisP 193 Posting Pro in Training

Hermelix, mark this thread as solved please

AndrisP 193 Posting Pro in Training

Line 12 - wrong syntax comma after last element of array

AndrisP 193 Posting Pro in Training

OOP its easy:

class Vehicle {
    public $transmission='manual'; // default value for transmission
    public $doors=4; // default value for doors
    public $engine; // without default value

    private function saveVehicleForm(){
        if(isset($_POST['transmissionTypeInput'])){
        $this->transmission = $_POST['transmissionTypeInput'];
        }
        if(isset($_POST['doors'])){
        $this->doors = $_POST['doors'];
        }
        // etc...
    }
}
AndrisP 193 Posting Pro in Training
$transmission_type = ( isset($_POST['transmissionTypeInput']) && $_POST['transmissionTypeInput']=='automatic' ? 'automatic' : 'manual' );
cereal commented: I misread OP request and focused on the first bit of code... correct solution +1 +13
AndrisP 193 Posting Pro in Training

Something like this:

SELECT 
    d.DealerShipID, 
    d.DealerShipName, 
    u.UserID, 
    u.UserName,
    u.Email,
    u.Phoneand 
FROM DealerShip d 
    LEFT JOIN Users u 
    ON u.DealerShipID = d.DealerShipID
    WHERE d.DealerShipName IN('a', 'b', 'c');
AndrisP 193 Posting Pro in Training

Don't use "Help Me" as a subject of topic please!

AndrisP 193 Posting Pro in Training

You mean mysqli_insert_id() ? http://php.net/manual/en/mysqli.insert-id.php

AndrisP 193 Posting Pro in Training

1) <li> inside <b> isn't ok - replace to <b> inside <li> instead
2) id need unique but in your example any <li> has same id
if you want multiple selected <li> use class instead of id and replace CSS #menu1 li#selected to #menu1 li.selected

AndrisP 193 Posting Pro in Training
<select name="dropdown">
<option value="">--Select--</option>
<?php
$a=mysql_query("Select * from student whre status='0'")or die(mysql_error());
$b=mysql_num_rows($a);
if($b >0)
{
while($row=mysql_fetch_array($a))
{
$selected = ( $row['st_id']=="id_for_compare" ? ' selected' : '' );
echo '
<option value="'.$row['st_id'].'"'.$selected.'>'.$row['name'].'</option>';
} } ?>
</select>

or use $row['name'] if you want compare rowname

AndrisP 193 Posting Pro in Training

set it as variable (PHP output), e.g:

<root somevariable="<?php echo 'somevalue'; ?>">
</root>

put in to the XSLT file:

<div class='rating'>
<xsl:attribute name="style">
    <xsl:value-of select="//@somevariable"/>
</xsl:attribute>
</div>
AndrisP 193 Posting Pro in Training
AndrisP 193 Posting Pro in Training

Sorry. parentNode in the your example is "movies".
Use child.parentNode.appendChild(newNode); or child.parentNode.insertBefore(newNode, child.nextSibling);

AndrisP 193 Posting Pro in Training

No!

NodeList movielist = doc.getElementsByTagName("movie")[0];
AndrisP 193 Posting Pro in Training

in the line 1

getElementsByTagName

is not unique selection it's a list. Try movielist[0]
or another way: child.parentNode.appendChild(newNode);

AndrisP 193 Posting Pro in Training

Line 4 replace: movielist.appendChild(newNode);
or if you want to put new node after resource to copy then check if child.nextSibling exist then movielist.insertBefore(newNode, child.nextSibling); otherwise movielist.appendChild(newNode);

AndrisP 193 Posting Pro in Training

And more compact version:

for(int i=0;i<10;std::cout<<i++<<std::endl);
AndrisP 193 Posting Pro in Training

Is the data types are identical on columns Pmin, Pmax and Tot?

AndrisP 193 Posting Pro in Training

No - Linux is a version of UNIX

AndrisP 193 Posting Pro in Training

for(i=0;i<=10;i++) it's 11 iterations
use for(i=1;i<=10;i++) or for(i=0;i<10;i++)

AndrisP 193 Posting Pro in Training

Latvian is my main language.
Russian perfectly.
Little English, little German.

AndrisP 193 Posting Pro in Training

If you define function after call it, then declare it before
e.g. put line int func_compare(int x, int y); before main()

AndrisP 193 Posting Pro in Training

Show source of "js/main.js" please

AndrisP 193 Posting Pro in Training

You can use <input type="number" min="0" /> instead of disable submit button in HTML5.

AndrisP 193 Posting Pro in Training

It seems that your submit clickable controlled by javascript

AndrisP 193 Posting Pro in Training

You read value from form input in to the JavaScript lines 7 and 8 and after you try read value from value in to the lines 12 and 13