AndrisP 193 Posting Pro in Training

Directory is created? Add to line 5 "or die('Cannot create directory')" eg
mkdir($dirname) or die ("Cannot create directory");
check web server error log file. Probably permission denied.

AndrisP 193 Posting Pro in Training

replace XSLT to:

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
    <xsl:strip-space elements="*"/>
    <xsl:output method="xml" indent="yes" encoding="utf-8"/>
    <xsl:template match="/">
        <doc xml:lang="de">
            <xsl:comment>Termine</xsl:comment>
            <p class="T_termine_fussball">
                <xsl:variable name="spieldatum" />
                <xsl:for-each select="tabelle/vorschaupaarungen/vorschaupaarung">
                    <xsl:if test="spieldatum != preceding-sibling::vorschaupaarung[1]/spieldatum">
                        <span class="C_termin">
                            <xsl:value-of select="normalize-space(substring(spieldatum,4,7))"/>
                        </span>
                    </xsl:if>
                    <span class="C_paarung">
                        <xsl:value-of select="heimmannschaft"/> - <xsl:value-of select="gastmannschaft"/>
                    </span>
                </xsl:for-each>    
            </p>
        </doc>
    </xsl:template>
</xsl:stylesheet>
AndrisP 193 Posting Pro in Training

Include database (line 9) should be outside of object User because in line 11 you define reference to db connection which is lost after comlete user construct

AndrisP 193 Posting Pro in Training

MySQLi method is shown in my first respond.
If you use bindParam() (PDO method - my second respond) $con should be PDO object.
Read http://php.net/manual/en/mysqli-stmt.bind-param.php and http://php.net/manual/en/pdostatement.bindparam.php

AndrisP 193 Posting Pro in Training

@Talib_1 this is (procedural) MySQLi method not PDO. The PDO would look something like this:

$stmt = $con->prepare("INSERT INTO table(id,s_id,date,time) VALUES (null,:s_id,:date,:time)");
$stmt->bindParam(':date', $date, PDO::PARAM_STR);
$stmt->bindParam(':time', $time, PDO::PARAM_STR);
foreach($s_id as $val){
    $stmt->bindParam(':s_id', $val, PDO::PARAM_INT);
    $stmt->execute();
}
Talib_1 commented: Thanks @AndrisP for your answer, I used this code appear(Fatal error: Call to a member function bindParam() on boolean) at line 2, how fix it? +0
AndrisP 193 Posting Pro in Training

Use prepared statement instead of direct insert to prevent from SQL injection!
Naming checkboxes with empty quadratic brackets e.g.

<input type="checkbox" name="s_id[]" value="1" />
<input type="checkbox" name="s_id[]" value="2" />
<input type="checkbox" name="s_id[]" value="3" />

PHP

$s_id=filter_input(INPUT_POST,'s_id',FILTER_VALIDATE_INT,FILTER_REQUIRE_ARRAY);
$date=filter_input(INPUT_POST,'datee');
$time=filter_input(INPUT_POST,'time');

$stmt = mysqli_prepare($con, "INSERT INTO table(id,s_id,date,time) VALUES(null,?,?,?)");
mysqli_stmt_bind_param($stmt, "iss", $id,$d,$t);
$d=$date;
$t=$time;
foreach($s_id as $val){
    $id = $val;
    mysqli_stmt_execute($stmt);
}
Talib_1 commented: Thank you Mr. Andrisp for your answer, I used you code but appear some warning, I don't understand PDO codes can you use MySQLi codes instead PDO? +0
AndrisP 193 Posting Pro in Training

Why you do not use a switch? It would be more convenient here:

function kal(ta){
    var xy=ta,x1,x2,x3,x4;
    switch(xy){
        case 1: x1=0; x2=1; x3=1; x4=1; break;
        case 2: x1=1; x2=0; x3=1; x4=0; break;
        case 3: x1=0; x2=1; x3=0; x4=1; break;
        case 4: x1=1; x2=1; x3=1; x4=1; break;
        case 5: x1=0; x2=0; x3=1; x4=0; break;
        case 6: x1=0; x2=1; x3=1; x4=0; break;
        case 7: x1=1; x2=1; x3=1; x4=0; break;
        case 8: x1=1; x2=0; x3=1; x4=1; break;
        case 9: x1=1; x2=1; x3=0; x4=1; break;
        case 10: x1=0; x2=0; x3=1; x4=1; break;
        case 11: x1=1; x2=1; x3=0; x4=0; break;
        case 12: x1=0; x2=0; x3=0; x4=1; break;
        case 13: x1=0; x2=1; x3=0; x4=0; break;
        case 14: x1=1; x2=0; x3=0; x4=0; break;
        case 15: x1=1; x2=0; x3=0; x4=1; break;
        case 16: x1=0; x2=0; x3=0; x4=0; break;
    }
    this.xa = x1;
    this.xb = x2;
    this.xc = x3;
    this.xd = x4;
    return this;
}
AndrisP 193 Posting Pro in Training

Look to the console: "as" is not defined (line 29 and 95), function in parameter "ta" not used inside function.

AndrisP 193 Posting Pro in Training

But string variable value should be in quotes

$q = mysql_query("SELECT `id` FROM `users` WHERE `name`='".$name."'"); 

this also is not good solution - use prepared statement to prevent from SQL injection

$stmt = mysqli_prepare($link, "SELECT `id` FROM `users` WHERE `name`=?");

and then bind variables, execute statement and fetch result

mysqli_stmt_bind_param($stmt, "s", $name);
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $id);
mysqli_stmt_fetch($stmt);
mysqli_stmt_close($stmt);
AndrisP 193 Posting Pro in Training

Table name and column name in MySQL query string should be without quotes or you can use backticks.

AndrisP 193 Posting Pro in Training

... or you want to crete new table "saveoffices" and migrate all data from "office1" and "office2"? Show your table structures and relations.

AndrisP 193 Posting Pro in Training

Use prepared statement instead of direct insert to prevent from SQL injection!
You try to save into table saveoffice?
To save into tables office1 and office2 try something like this:

<?php

$link = mysqli_connect("localhost", "username", "password", "database");

$result = [];
for($i=1; $i<=2; $i++){
    $office = filter_input(INPUT_POST, 'offices'.$i);
    $result[$i] = 0;
    if($office){
        $stmt = mysqli_prepare($link,"INSERT INTO `office$i`(`off$i`) VALUES (?)");
        mysqli_stmt_bind_param($stmt, "s", $office);
        mysqli_stmt_execute($stmt);
        $result[$i] = (string)(mysqli_stmt_affected_rows($stmt));
    }
    echo 'off'.$i.' inserted '.$result[$i].' rows<br/>';
}

?>
AndrisP 193 Posting Pro in Training

It is not right answer - redundant white space after hiphens
right is: (\d{3}[-]){2}\d{5} (three digits with followed hiphens) {two times} and then five digits

AndrisP 193 Posting Pro in Training

Other way:

$(document).ready(function() {
    let today = new Date().toISOString().substr(0, 10);
    $("#datePicker").val(today);
});
AndrisP 193 Posting Pro in Training

I see you are using <input type="date" /> - do not need set date by jQuery, just add value (format YYYY-MM-DD), e.g. <input type="date" value="2018-09-24" />

pty commented: This is the best way by a mile +9
Jon_7 commented: Looks simple enough, but I can't get it to work +1
rproffitt commented: Today is that day. +15
AndrisP 193 Posting Pro in Training

Read tech spec abot your graphic card - max count of monitors, sum of max pixel-width and sum of max pixel-height

AndrisP 193 Posting Pro in Training

Your mistake is here caption='Harry' s SuperMart '

AndrisP 193 Posting Pro in Training

you can call destructor by set object to NULL e.g.

$stefan = new person();
$jimmy = new person();
$stefan->set_name('stefan');
$jimmy->set_name('jimmy');
echo "Stefan Full Name : ".$stefan->get_name();
echo "Jimmy Full Name : ".$jimmy->get_name();

$stefan = NULL;
$jimmy = NULL;
AndrisP 193 Posting Pro in Training

Also edit functions:

function set_name($new_name){
    $this->name = $new_name;
}

and

function get_name(){
    return $this->name;  
}
AndrisP 193 Posting Pro in Training

... or call constructor with param:

$stefan = new person('Stefan');
AndrisP 193 Posting Pro in Training

Edit __constructor to __construct and __destructor to __destruct.
If you define function with required argument then you cant initialize it without argument e.g.
Constructor with required argument:

function __construct($person_name){
    echo "Initialize class";
    $this->set_name($person_name);
}

Same contructor but argument is optional (set default value):

function __construct($person_name=NULL){
    echo "Initialize class";
    if($person_name !== NULL){
        $this->set_name($person_name);
    }
}
AndrisP 193 Posting Pro in Training

Try to rename JS function to different from select element ID.
And a few more tips:
if you declare XHTML document then always close tags. The XHTML syntax does not allow unclosed <br> or <input type="checkbox" id="event_ltm" name="event_ltm[]" value="1"> etc elements
Good practice defines an object that is once declared not to be redeployed e.g. declare it in php

<?php

$postcodeLists = array(
    "Select a Region" => [],
    "Channel Islands" => [ "GY", "JE"],
    "East Midlands" => ["CB", "CO", "DE", "DN", "IP", "LE", "LN", "NG", "NR", "PE", "S"],
    "Greater London" => ["BR", "CR", "DA", "E", "EC", "EN", "HA", "IG", "KT", "N", "NW", "RM", "SE", "SM", "SW", "TW", "UB", "W", "WC", "WD"],
    "Isle of Man" => ["IM"],
    "North East" => ["DH", "DL", "HG", "HU", "LS", "NE", "SR", "TS", "WF", "YO"],
    "North West" => ["BB", "BO", "BL", "CA", "CH", "CW", "FY", "HX", "L", "LA", "M", "OL", "PR", "SK", "WA", "WN"],
    "Northern Ireland" => ["BT"],
    "Scotland" => ["AB", "DD", "DG", "EH", "FK", "GH", "SI", "VK", "AK", "WK", "YM", "LP", "AP", "MT", "D", "ZE"],
    "South East" => ["AL", "BN", "CM", "CT", "GU", "HP", "LU", "ME", "MK", "OX", "PO", "RG", "RH", "SG", "SL", "SO", "SS", "TN"],
    "South West" => ["BA", "BH", "BS", "DT", "EX", "GL", "PL", "SN", "SP", "TA", "TQ", "TR"],
    "Wales" => ["CF", "LD", "LL", "NP", "SA", "SY"],
    "West Midlands" => ["B", "CV", "DY", "HR", "NN", "ST", "TF", "WR", "WS", "WV"]
);

?>

and pass it to JS e.g.

<script type="text/javascript">
 //<![CDATA[ 
 // array of possible countries in the same order …
AndrisP 193 Posting Pro in Training

In nyour code if case in line 32 allways true because actually you check if exist array which defined inside self if case.
Get file extension e.g.

$ext = pathinfo($_FILES["images"]["name"], PATHINFO_EXTENSION);

and then check if in array e.g.

if(!in_array(strtolower($ext), $allowed)){
    die("Not a gif/jpeg/png");
}
AndrisP 193 Posting Pro in Training

Use send_long_datahttp://php.net/manual/en/mysqli-stmt.send-long-data.php for blob upload in to the DB and use prepared statement to prevent from SQL injection.

AndrisP 193 Posting Pro in Training

If you wanti to create new table each day then you can create stored MySQL procedure e.g.

delimiter $$
create procedure `user_earning`(in p_name varchar(30), in p_earn decimal(6,2), out p_sum decimal(6,2))
begin
    set @user_name=p_name, @earn=p_earn, @tb_name = concat('daily_earning_',current_date);

    set @sql_table_create = concat('create table if not exists `',@tb_name,'` (
        `id` int primary key not null auto_increment
        ,`user_name` varchar(30)
        ,`earn` decimal(6,2)
        ,unique key(`user_name`)
    ) engine innodb default charset utf8 collate utf8_general_ci;');
    prepare stmt1 from @sql_table_create;
    execute stmt1;
    deallocate prepare stmt1;
    commit;

    set @sql_table_insert = concat('insert into `', @tb_name, '`(`user_name`,`earn`) 
    values (?,?) on duplicate key update `earn` = `earn` + values(`earn`);');
    prepare stmt2 from @sql_table_insert;
    execute stmt2 using @user_name, @earn;
    deallocate prepare stmt2;
    commit;

    set @sql_data_select = concat('select `earn` into @earn_sum from `', @tb_name, '` where `user_name` like ?');
    prepare stmt3 from @sql_data_select;
    execute stmt3 using @user_name;
    deallocate prepare stmt3;
    set p_sum = @earn_sum;
end; $$
delimiter ;

and then call from php script:

$sql = "call `user_earning`(:bv_user_name, :bv_add_earn, @p_sum);
select :bv_user_name as 'user', :bv_add_earn as 'add', @p_sum as 'sum';";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':bv_user_name', $user, PDO::PARAM_STR, 30);
$stmt->bindParam(':bv_add_earn', $earn, PDO::PARAM_STR, 6);
$user = $user_name;
$earn = $add_sum;
$stmt->execute();
$rowset = 0;
do {
    if($rowset===1){
        $result = $stmt->fetch(PDO::FETCH_ASSOC);
    }
    ++$rowset;
    while ($stmt->nextRowset());
}
print_r($result);

This will create 30 tables each month (365 tables each year). Do you need it?
Other solution make table e.g.

create table if not exists `user_earning` (
    `id` int primary key not null auto_increment
    ,`earn_date` date
    ,`user_name` varchar(30)
    ,`earn` decimal(6,2)
    ,unique key(`earn_date`,`user_name`)
) engine innodb default charset utf8 collate utf8_general_ci;
AndrisP 193 Posting Pro in Training

php function time() also return timestamp but what about it with a table create?

AndrisP 193 Posting Pro in Training

@klaus.veliu - Safe version is

    $users=array("Vito","Joey","Vinny");
    $prep=str_pad("?",count($users)*2-1,",?"); // produce string '?,?,?'
    $sql = "SELECT * FROM `users` WHERE `name` in (".$prep.")";
    $stmt = $db->prepare($sql);
    $stmt->execute($users);
    $result = $stmt->fetchAll(PDO::FETCH_ASSOC);

or

    $users=array("Vito","Joey","Vinny");
    $sql = "SELECT * FROM `users` WHERE FIND_IN_SET(`name`,?)";
    $stmt = $db->prepare($sql);
    $stmt->execute([implode(",",$users)]);
    $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
AndrisP 193 Posting Pro in Training

It's a margin of

            <h2 class="utopic-flowers">
                <span>u</span>topic <span>f</span>lowers
            </h2>

try to replace e.g.

            <b class="utopic-flowers">
                <span>u</span>topic <span>f</span>lowers
            </b>

and you will see that the extra margin of input element disappears

AndrisP 193 Posting Pro in Training

Show your function getListed

AndrisP 193 Posting Pro in Training

Outside of main template define two variables and another template:

    <xsl:variable name="quot">"</xsl:variable>
    <xsl:variable name="doublequot">""</xsl:variable>

    <xsl:template name="string-replace-all">
        <xsl:param name="text" />
        <xsl:choose>
            <xsl:when test="contains($text, $quot)">
                <xsl:value-of select="substring-before($text,$quot)" />
                <xsl:value-of select="$doublequot" />
                <xsl:call-template name="string-replace-all">
                    <xsl:with-param name="text" select="substring-after($text,$quot)" />
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$text" />
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

and lines 157-161 in XSLT file replace to:

            <xsl:text>"</xsl:text>
            <xsl:call-template name="string-replace-all">
                <xsl:with-param name="text" select="FSA_TEXT" />
            </xsl:call-template>
            <xsl:text>"</xsl:text>
AndrisP 193 Posting Pro in Training

Convert to raw after encrypt and save as raw data in to the db.

AndrisP 193 Posting Pro in Training
  1. Do not need make new connection in line 30 - use existing
  2. If you want to post multiple "room" define field name as array <select name="room[]"> or <select name="room[$i]">
  3. Set option value e.g. <option value="$rname">$rname</option>
  4. I recommend you use filter_input(INPUT_POST, 'room') instead of $_POST['room'] e.g.

    $room = filter_input(INPUT_POST, 'room', FILTER_SANITIZE_STRING, FILTER_REQUIRE_ARRAY);
  5. use prepared statement instead of lines 8-13, e.g.

    $room = filter_input(INPUT_POST, 'room', FILTER_SANITIZE_STRING, FILTER_REQUIRE_ARRAY);
    $sql="INSERT INTO users(speaker) VALUES (?)";
    $stmt = $MySQLiconn->prepare($sql);
    foreach($room as $row){
            $stmt->bind_param("s",$row);
            $stmt->execute();
    }
AndrisP 193 Posting Pro in Training

Do not include any outside of <head></head> and <body></body> check line 20 in your code sample

AndrisP 193 Posting Pro in Training

Your method are wrong for BLOBs - read this manual

AndrisP 193 Posting Pro in Training

Show your reference table structure employees

AndrisP 193 Posting Pro in Training

You can select by country name but it is not good practice

    echo "<option value=\"".$row['NAME']."\">".$row['NAME']."</option>";
AndrisP 193 Posting Pro in Training

Select also ID of country.

<tr> <td>Country Name</td> <td> <select name="countryID"> <?php
      $conn = oci_connect("username", "pswrd", "db");
      $sql = 'SELECT id,name FROM country';
      $stid = oci_parse($conn, $sql);
      $success = oci_execute($stid);
      while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS+OCI_ASSOC)) 
      {
        echo "<option value=\"" . $row['ID'] . "\">" . $row['NAME'] . "</option>";
      }
    ?>
AndrisP 193 Posting Pro in Training

Use of & inside REQUEST variable is not good idea. I suggest replace to and but if you realy want to use it then use as &amp;

AndrisP 193 Posting Pro in Training

I suggest to you use filter_input() method instead of $_GET['page'] and set min, max, default values:

<?php
$perPage = 6;

$stmt = $conn->prepare("select count(*) from tbl");
$stmt->execute();
$productCount = $stmt->fetchColumn();
$totalPages = ceil($productCount/$perPage)-1;

$options = array('options'=>
    array('min'=>0,'max'=>$totalPages,'default'=>0)
);
$page = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT, $options);
?>

Use 0 for first page is more conveniet for mathematical manipulations. Only innerHTML use (page+1) for show human readable page number.

<?php
if($page===0){
    echo '<li class="disabled"><span aria-hidden="true">«</span></li>';
}
else {
    echo '<li><a href="products.php?page='.($page-1).'" aria-label="Previous"><span aria-hidden="true">«</span></a></li>';
}

for($i=0; $i<=$totalPages; $i++){
    $active = ($i == $page ? ' class="active"' : '');
    echo '<li'.$active.'><a href="products.php?page='.$i.'">'.($i+1).'</a></li>';
}

if($page>=$totalPages){
    echo '<li class="disabled"><span aria-hidden="true">»</span></li>';
}
else {
    echo '<li><a href="products.php?page='.($page+1).'" aria-label="Previous"><span aria-hidden="true">»</span></a></li>';
}

?>
AndrisP 193 Posting Pro in Training

Try echo "<option value=\"countryname1\">" . $row[(array_keys($row)[0])] . "</option>";

AndrisP 193 Posting Pro in Training

Try echo "<option value=\"countryname1\">" . $row['NAME'] . "</option>";
Oracle DB usually return column names in upper case

AndrisP 193 Posting Pro in Training

https://i.stack.imgur.com/YEopy.png it seems like fill by empty options. Check "Inspect Element" in browser.
https://i.stack.imgur.com/dRS39.png Check your column names. In oracle db column name are not case sensitive but in PHP it's case sensitive.

AndrisP 193 Posting Pro in Training

Are dropdown list fill by empty options or list is empty?

AndrisP 193 Posting Pro in Training

Try to handle other errors

    <tr> <td>Country Name</td> <td> <select name="name"> <?php
      $conn = @oci_connect("username", "pswrd", "db");
      $e = oci_error();
      if($e){
        exit($e['message']);
      }

      $sql = 'SELECT name FROM country';
      $stid = @oci_parse($conn, $sql);
      if(!$stid){
        $e = oci_error($conn);
        exit($e['message']);
      }
      $success = @oci_execute($stid);
      if(!$success){
        $e = oci_error($conn);
        exit($e['message']);
      }
      while ($row = oci_fetch_assoc($stid)) 
      {
        echo "<option value=\"countryname1\">" . $row['name'] . "</option>";
      }
    ?>
AndrisP 193 Posting Pro in Training

Method oci_fetch_array() will return all rows. Change to oci_fetch_assoc()

AndrisP 193 Posting Pro in Training

Add backslashes before apostrophes onclick="window.location.href='route(\'pemesanan\')';" if you have to pass string pemesanan or add plus onclick="window.location.href='route('+pemesanan+')';" if "pemesanan" is javascript (number or object) variable name
or put both if it string variable name onclick="window.location.href='route(\''+pemesanan+'\')';"

AndrisP 193 Posting Pro in Training

Sorry i was wrong about last 4 bits

AndrisP 193 Posting Pro in Training

Actually results is numbers divisible by 12. Another way to find - check last 4 bits. It should be 1100

AndrisP 193 Posting Pro in Training

Declare table type variable if you want to return e.g.

type r_model_price is record (
    p_model MODELS.NAME_MODEL%type
    ,p_price AUTOMOBILES.A_PRICE%type
);
type tt_model_price is table of r_model_price index by binary_integer;

create or REPLACE procedure modelzz(
    VAR_MODEL IN MODELS.NAME_MODEL%TYPE
    ,VAR_MODEL_PRICE OUT tt_model_price
) as
    cursor c_automobiles is 
    SELECT m.NAME_MODEL, a.A_PRICE
    FROM AUTOMOBILES a
    join MODELS m
    on a.MODELS_ID_MODEL=m.ID_MODEL
    where m.NAME_MODEL=VAR_MODEl;
    v_model_price c_automobiles%rowtype;
    v_increment integer default 0;
begin
open c_automobiles;
    loop
        fetch c_automobiles into v_model_price;
        exit when c_automobiles%notfound;
        v_increment := v_increment + 1;
        VAR_MODEL_PRICE(v_increment).p_model := v_model_price.NAME_MODEL;
        VAR_MODEL_PRICE(v_increment).p_price := v_model_price.A_PRICE;
    end loop;
close c_automobiles;
end modelzz;
AndrisP 193 Posting Pro in Training

Try something like this:

create or REPLACE procedure modelzz(
    VAR_MODEL IN MODELS.NAME_MODEL%TYPE
) as
    cursor c_automobiles is 
    SELECT a.A_PRICE
    FROM AUTOMOBILES a
    join MODELS m
    on a.MODELS_ID_MODEL=m.ID_MODEL
    where m.NAME_MODEL=VAR_MODEl;
    VAR_PRICE AUTOMOBILES.A_PRICE%TYPE;
begin

open c_automobiles;
    loop
        fetch c_automobiles into VAR_PRICE;
        exit when c_automobiles%notfound;
        dbms_output.put_line(
            VAR_MODEL||'''s price is : '||VAR_PRICE
        );
    end loop;
close c_automobiles;

end modelzz;