AndrisP 193 Posting Pro in Training

$A need to incremented after endif; but print whatever

<?php
    $A=0;
    while ($auction = $result->fetch_assoc()):
        if ($A%3==0): ?><br/><?php endif;
        $A++;
        ?>
        <div style="float:left;">
            <h4><?=$auction['item_name']?></h4>
            <img src="<?=$auction['item_image']?>" class="img-responsive">
            <span id="countdown" class="timer">how</span>
            <button class="c-button" name='bid'>Bid Now!</button>
        </div><?php
    endwhile;
?>
rproffitt commented: Increment +1. +12
AndrisP 193 Posting Pro in Training
  1. mysqli_query() should be inside for (line 15)
  2. Use filter_input() to sanitize user input variables
  3. Bind variables after prepare
AndrisP 193 Posting Pro in Training
  1. Read manual about coommit http://php.net/manual/en/function.oci-execute.php
  2. Bind variables after oci_parse to prevent from SQL injection http://php.net/manual/en/function.oci-bind-by-name.php
AndrisP 193 Posting Pro in Training
  1. Replace method = "POST" without white spaces method="POST"
  2. I see in HTML form name="USERNAME" and name="USER_PASSWORD" but you try to get values from $_POST['username'] and $_POST['pass'] - it case sensitive and do not match password field name
  3. I want to remind you again PASSWORD SHOULD BE CRYPTED! Never save unencrypted passwords in the database!
  4. Your user authorization method is invalid - any user can authorize with other user name and self password
AndrisP 193 Posting Pro in Training

Where you define variables $textfile_occupation, $institution, $UserLogin ?
Where you execute $query_insert ?

AndrisP 193 Posting Pro in Training

Sorry mistake in my post oci_prepare is not a function - correct function name is oci_parse. Use similar variable names for connect to db and authorize user also is very bad idea.

AndrisP 193 Posting Pro in Training

Check your post variables print_r($_POST)

AndrisP 193 Posting Pro in Training

To prevent from SQL injection bind variables after oci_prepare read http://php.net/manual/en/function.oci-bind-by-name.php

AndrisP 193 Posting Pro in Training

It raise in line 26 if post variable not set. Use function filter_input () in lines 2 and 3. Remove lines 13-27

AndrisP 193 Posting Pro in Training
  1. Password should be crypted!
  2. In to the lines 2 and 3 variables defined - ok. But do not need set default values because if not set both post variables then in lines 13-17 values not replaced!
  3. Lines 26 and 27 you again try to get values from post variables - any previous activities with variables $username and $password replaced in this step.

I recommend use filter_input() function

AndrisP 193 Posting Pro in Training

Maybe browser show cached images. Try generate different file names to output image

rproffitt commented: Good point. Thing 1, Thing 2, etc. +12
AndrisP 193 Posting Pro in Training

Sorry comma missing in my previous post

<?php
prepare("Insert into flood_light (
    Name,
    Brand,
    Quantity,
    Detail,
    Unit,
    Color,
    Material,
    Image)
VALUES(?,?,?,?,?,?,?,?) on duplicate key update
set Name = VALUES(Name)
,Brand = VALUES(Brand)
,Quantity = VALUES(Quantity)
,Detail = VALUES(Detail)
,Unit = VALUES(Unit)
,Color = VALUES(Color)
,Material = VALUES(Material)"); 
execute(
    [$name,
    $brand,
    $quantity,
    $detail,
    $unit,
    $color,
    $material,
    $image]
);
AndrisP 193 Posting Pro in Training

line 13 should be print(self.question)
and similar mistake in the line 22

AndrisP 193 Posting Pro in Training

Set unique key constraint image and then insert/update in one SQL e.g.
prepare("Insert into flood_light (Name, Brand, Quantity, Detail, Unit, Color, Material, Image) values(?,?,?,?,?,?,?,?) on duplicate key update set Name = VALUES(Name), Brand = VALUES(Brand), Quantity = VALUES(Quantity), Detail = VALUES(Detail), Unit = VALUES(Unit) Color = VALUES(Color), Material = VALUES(Material)"); execute([$name, $brand, $quantity, $detail, $unit, $color, $material, $image]);

AndrisP 193 Posting Pro in Training

Invalid column name phone number. You can use space separated column name inside bockqoutes e.g. CREATE TABLE BUILDING(bname VarChar2(30) PRIMARY KEY, address VarChar2(30), "phone number" Number(15));

AndrisP 193 Posting Pro in Training

Directive AllowOverride All need set to default config file

AndrisP 193 Posting Pro in Training

By default .htaccess is disabled. To use it set directive AllowOverride All

AndrisP 193 Posting Pro in Training

You can set directive in to the file /etc/apache2/sites-available/000-default.conf e.g.

    <Directory /path/to/your/localhost/public_html/>
        Options FollowSymLinks MultiViews Includes Indexes
        AllowOverride All
        Require all granted
    </Directory>

(reload apache)
if missing file index.php (or other filename who is set on the DirectoryIndex directive) then open in browser http://localhost/ or http://localhost/non_exists_filename.php shows directory listing. Remove Indexes to be safe (reload apache).

AndrisP 193 Posting Pro in Training
AndrisP 193 Posting Pro in Training
  1. Password should be crypted!
  2. Use filter_input() function e.g. $username = filter_input(INPUT_POST, "username");
  3. Check if($username !== NULL && $password !== NULL){ ... } before query
  4. Do not put user input parameters directly to SQL query! - Use prepared statement: prepare(), bind_param(), execute()
  5. For precise string comparison use like binary instead of =
AndrisP 193 Posting Pro in Training

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
rproffitt commented: Yes, please multiply my salary by the date. We'll all be millionaires in no time. +12
AndrisP 193 Posting Pro in Training

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

AndrisP 193 Posting Pro in Training

It's a dual boot PC? If yes maybe Windows system is sleep or hybrid sleep not succesfully shut down.

AndrisP 193 Posting Pro in Training

Querie (line 13) is out of foreach (lines 9-11)

AndrisP 193 Posting Pro in Training

I think that so many subqueries will make slow SQL execution. Use left join and build PHP object from query results.

AndrisP 193 Posting Pro in Training

It seems ok. Save it in the DB as view. I'm notice in this select you can not order shops and can not order devices. Can order by employee name only.

AndrisP 193 Posting Pro in Training

You need set foreign key (on delete cascade) constraints also. It will prevent to zombie entries in the table “employees_shops”.

AndrisP 193 Posting Pro in Training

If you can not set unique names for employees edit procedure - change input parameter p_name varchar to p_id int and pass "id" directly

AndrisP 193 Posting Pro in Training

Yes unique key constraint will not allow duplicate entries when you call procedure edit_relation many times with the same input parameters (input ignore into .....). Table employees field name and table shops field shop also should be unique otherwise selects inside procedure can return many results and its raise error.
Replace in your PHP lines 43, 44

$stmt = $this->db->prepare("CALL edit_relation(?,?,true)");
$stmt->execute(array($user, $shop));
AndrisP 193 Posting Pro in Training

MySQL:

select date_format(now(), '%d-%m-%Y');

PostgreSQL:

select to_char(now(), 'dd-mm-yyyy');

OracleSQL:

select to_char(sysdate, 'dd-mm-yyyy') from dual;

Clause from dual in Oracle is required, in MySQL is optional, in PG SQL not usable - raise error

AndrisP 193 Posting Pro in Training
cereal commented: Good catch! +14
AndrisP 193 Posting Pro in Training

You can create stored procedure for convenient use add or delete relations in the table shop_employees eg

delimiter $$
create procedure `edit_relation`(in p_name varchar(9), in p_shop varchar(9), in p_add boolean)
begin
    declare e_id int;
    declare s_id int;
    select t.`id` into e_id from `employees` t where t.`name` like p_name;
    select t.`shop_id` into s_id from `shops` t where t.`shop` like p_shop;
    case when p_add then
        insert ignore into `shop_employees`(`employee_id`,`shop_id`)
        values (e_id, s_id);
    else
        delete from `shop_employees`
        where `employee_id` = e_id and `shop_id` = s_id;
    end case;
end; $$
delimiter ;

and then call edit_relation('user1','shop1',true) for add relation
or call edit_relation('user1','shop1',false) for delete relation.
I recommend set on the "shop_employees" table

unique key (`employee_id`, `shop_id`)

if it is not yet

AndrisP 193 Posting Pro in Training

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

AndrisP 193 Posting Pro in Training

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 UPDATE
SET `distanta` = VALUES(`distanta`)
,`durata` = VALUES(`durata`)
,`start` = VALUES(`start`)
,`end` = VALUES(`end`);
AndrisP 193 Posting Pro in Training
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;
AndrisP 193 Posting Pro in Training

Elements within <defs> is not visible - need linked.

<?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 200 200">
<defs>
    <mask id="chain">
        <rect width="100%" height="100%" fill="white" />
        <circle class="LcircleChain" cx="25.3" cy="11.3" r="6.2" fill="black" />
        <circle class="RcircleChain" cx="58.6" cy="11.3" r="6.2" fill="black" />
    </mask>
    <path id="chainy" d="M70,11.6 C70,17.9,65.3,23,59.5,23 c-1.5,0-2.9-0.3-4.2-1 c0.3,0.2-7-3.2-13.4-3.2 C36.1,18.7,26,23,23.5,23 c-5.7,0-10.2-5.1-10.2-11.3 c0-6.3,4.6-11.3,10.2-11.3 c1.7,0,9.5,2.9,16.7,3.2 c6.9,0.3,17.2-3.2,19.3-3.2 C65.3,0.3,70,5.4,70,11.6 z"
            fill="white" mask="url(#chain)" />
</defs>

<use xlink:href="#chainy" x="0" y="0" />

</svg>

or other way to get the same result

<!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 200 200">
<defs>
    <mask id="chain">
        <path id="chainy" d="M70,11.6 C70,17.9,65.3,23,59.5,23 c-1.5,0-2.9-0.3-4.2-1 c0.3,0.2-7-3.2-13.4-3.2 C36.1,18.7,26,23,23.5,23 c-5.7,0-10.2-5.1-10.2-11.3 c0-6.3,4.6-11.3,10.2-11.3 c1.7,0,9.5,2.9,16.7,3.2 c6.9,0.3,17.2-3.2,19.3-3.2 C65.3,0.3,70,5.4,70,11.6 z"
            fill="white" />
        <circle class="LcircleChain" cx="25.3" cy="11.3" r="6.2" fill="black" />
        <circle class="RcircleChain" cx="58.6" cy="11.3" r="6.2" fill="black" />
    </mask>
</defs>

<rect x="0" y="0" width="120" height="60" fill="white" mask="url(#chain)" />

</svg>
AndrisP 193 Posting Pro in Training

Black by default

AndrisP 193 Posting Pro in Training

Sorry I am not clear what outcome you expect. Maybe put image examle.
In to the mask tags you can define white rect 100% width and 100% height as first shape and then define other (black) shapes to get holes. Over to black shape you can also define white shapes. My gear example:

<?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 200 200">
<defs>
    <circle id="circleGear" r="10" cx="100" cy="50" />
    <mask id="gear">
        <rect width="100%" height="100%" fill="white" />
        <use xlink:href="#circleGear" transform="translate(0 50)" />
        <g>
            <use xlink:href="#circleGear" transform="rotate(0 100 100)" />
            <use xlink:href="#circleGear" transform="rotate(45 100 100)" />
            <use xlink:href="#circleGear" transform="rotate(90 100 100)" />
            <use xlink:href="#circleGear" transform="rotate(135 100 100)" />
            <use xlink:href="#circleGear" transform="rotate(180 100 100)" />
            <use xlink:href="#circleGear" transform="rotate(225 100 100)" />
            <use xlink:href="#circleGear" transform="rotate(270 100 100)" />
            <use xlink:href="#circleGear" transform="rotate(315 100 100)" />
        </g>
    </mask>
</defs>

<rect x="0" y="0" width="200" height="200" fill="grey" />
<circle cx="100" cy="100" r="50" fill="red" mask="url(#gear)" />

</svg>
AndrisP 193 Posting Pro in Training

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" />
            <circle cx="100" cy="100" r="10" fill="black" />
        </mask>
        <mask id="mask_2">
            <circle cx="400" cy="100" r="50" fill="white" />
            <circle cx="400" cy="100" r="30" fill="black" />
            <circle cx="400" cy="100" r="10" fill="white" />
        </mask>
    </defs>

    <rect x="0" y="0" width="500" height="200" fill="grey" />
    <circle cx="100" cy="100" r="50" fill="red" mask="url(#mask_1)" />
    <circle cx="400" cy="100" r="50" fill="green" mask="url(#mask_2)" />
</svg>
AndrisP 193 Posting Pro in Training

In line 4 form action change to

<form name="form" action="<?php echo filter_input(INPUT_SERVER, 'PHP_SELF'); ?>" method="post">   
AndrisP 193 Posting Pro in Training

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 to give the same result:

<?php
$numbers = ["one","two","three","four","five"];
?>
AndrisP 193 Posting Pro in Training

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

AndrisP 193 Posting Pro in Training

... and paste here SQL error message

AndrisP 193 Posting Pro in Training

img open "<" tag is missing in line 49 and required attribute "alt" is missing also - alt text is very necessary for people with sight problems. Alt text always should be say something about picture for using screen reader.

AndrisP 193 Posting Pro in Training
  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 PHP function filter_input() or filter_input_array() - it will help you to avoid from incorrect user input
  4. Fourth step - I strongly recommend use prepared statement, then bind variables and then execute statement - it will protect you from MySQL injection
AndrisP 193 Posting Pro in Training

Try CURLOPT_RETURNTRANSFERinstead of RETURNTRANSFER http://php.net/manual/en/function.curl-setopt.php

AndrisP 193 Posting Pro in Training

It seems your trigger working fine Screenshot.png

AndrisP 193 Posting Pro in Training

"Please help" is not subject of this topic!

AndrisP 193 Posting Pro in Training

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(
                    'filter'    => FILTER_SANITIZE_STRING
                    ),
                'member_registration_email' => array(
                    'filter'    => FILTER_VALIDATE_EMAIL
                    ),
                'member_registration_email_confirmation' => array(
                    'filter'    => FILTER_VALIDATE_EMAIL
                    )
                );
            $post = filter_input_array(INPUT_POST, $args);
AndrisP 193 Posting Pro in Training

How mutch TEMPLATE_ID = 106 is in your subquery?