• Member Avatar for AndrisP
    AndrisP

    Replied To a Post in loop nested php array menu

    And do not redefine svg objects on each use it, reuse defined objects instead e.g. css #svg_sources { position: fixed; top: 0; left: 0; } html <html xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg"> <head> …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in loop nested php array menu

    Use recursive printing e.g. <?php function print_recursive($list){ echo '<ul>'; foreach($list as $item){ echo '<li id="'.$item['id'].'">'.$item['text']; if( isset($item['children']) ){ print_recursive($item['children']); } echo '</li>'; } echo '</ul>'; } print_recursive($list); ?>
  • Member Avatar for AndrisP
    AndrisP

    Began Watching loop nested php array menu

    hii, i want to ask how to loop this array for menu like in images public $list = [ [ 'id' => 'dashboard', 'text' => 'Dashboard', 'icon' => 'feather-home', ], …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in How to link table "implode array in one cell" with foreign key?

    I think You need normalize DB-tables for first. create table Pensyarah( IDPensyarah integer not null primary key auto_increment , IDUser varchar(50) not null , NamaPensyarah varchar(100) not null , Email …
  • Member Avatar for AndrisP
    AndrisP

    Began Watching How to link table "implode array in one cell" with foreign key?

    Thank you for looking at this problem, details are all below. Below is the code <form style="overflow: hidden;" method="post"> <input type="checkbox" aria-label="Checkbox for following text input" name="kursus[]" value="<?php echo $row['IDKursus']; …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Problem querying SQLite database

    In your examples 2 and 3 are missing final `}` on `while` loop
  • Member Avatar for AndrisP
    AndrisP

    Began Watching Problem querying SQLite database

    Hi. I have a local installation of SQLite3 and PHP which runs a small in house PHP application so sql injection is not an issue. I am able to execute …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Why am I getting a network error regardless of what file I try to download

    What about `require` - files exists on defined path?
  • Member Avatar for AndrisP
    AndrisP

    Began Watching Why am I getting a network error regardless of what file I try to download

    The following code works without errors on my local server but when I put it up on my hosted website, I get a "Failed - Network Error" message immediately. The …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in SQLite query to return records earlier than a certain year?

    I think your mistake is comparing string and number ![SQLite.png](https://static.daniweb.com/attachments/4/7066cc9b4c0eb84ab280812562ca5270.png) You should be use `cast(strftime('%Y', HireDate) as number)<2003`
  • Member Avatar for AndrisP
    AndrisP

    Began Watching SQLite query to return records earlier than a certain year?

    I am trying to come up with an SQL query to return all the records earlier than a certain year with SQLite using DB Browser. I can't seem to come …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Search problem(value is store in reverse order)

    I think your mistake is mixed use of variable names "searchdata" and "searchname"
  • Member Avatar for AndrisP
    AndrisP

    Began Watching Search problem(value is store in reverse order)

    i have two page one is search.php and other is detail.php in search.php <div class="search-field "> <form class="d-flex align-items-center h-100" name="search" action="manage_visitor.php" method="post" > <div class="input-group" style="background-color: #f2edf3;"> <input type="text" …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Uncaught Error: Call to undefined function mysql_query()

    I'm sorry - check your PHP version. Extension "mysql_..." depraceted in PHP 5.5.0 and removed in PHP 7 [mysql_query](https://www.php.net/manual/en/function.mysql-query.php)
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Uncaught Error: Call to undefined function mysql_query()

    For first check your MySQL version select version() from dual; Because all `"mysql_..."` in current (MySQL 8.0.) is deprecated - probably you should be use `"mysqli_..."` instead
  • Member Avatar for AndrisP
    AndrisP

    Began Watching Uncaught Error: Call to undefined function mysql_query()

    Hi I have this PHP Code - <?php require_once ("../include/initialize.php"); if (!isset($_SESSION['ACCOUNT_ID'])){ redirect(web_root."index.php"); } $action = (isset($_GET['action']) && $_GET['action'] != '') ? $_GET['action'] : ''; switch ($action) { case 'add' …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in There is no Image to show after I upload image

    1. I recomend use prepared statement instead of directly put user input data to SQL query. 2. Use [SEND_LONG_DATA](https://www.php.net/manual/en/mysqli-stmt.send-long-data.php) to store blob into database.
  • Member Avatar for AndrisP
    AndrisP

    Began Watching There is no Image to show after I upload image

    <?php if (count($_FILES) > 0) { if (is_uploaded_file($_FILES['userImage']['tmp_name'])) { $imgData = addslashes(file_get_contents($_FILES['userImage']['tmp_name'])); $imageProperties = getimageSize($_FILES['userImage']['tmp_name']); $sql = "INSERT INTO qr(user_id,file_name ,QrCode) VALUES('".$_SESSION['id']."','{$imageProperties['mime']}', '{$imgData}')"; $current_id = mysqli_query($db, $sql) or die("<b>Error:</b> Problem …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Add data to table -

    Better solution is create view with join nested tables and then search in view
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Add data to table -

    if you want to denormalize SQL table for search then you think wrong
  • Member Avatar for AndrisP
    AndrisP

    Began Watching Add data to table -

    I'm trying to modify a web script. Currently, upon uploading a video, in the upload Form, among other things, the uploader chooses a sub-category and enters tags and then submits/uploads. …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in need to change the color of submit button if input has some value

    Use CSS e.g. input[type="button"][value="one"] { background: blue; } input[type="button"][value="two"] { background: red; }
  • Member Avatar for AndrisP
    AndrisP

    Began Watching need to change the color of submit button if input has some value

    i have form., in that form i have input field and confirm button., i just want to change the confirm button color if input has some value otherwise the button …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Show the array values as a radio button

    Radio buttons let a user select ONLY ONE of a limited number of choices Use same attribute "name" but array of values use as attribute "value" e.g. var div = …
  • Member Avatar for AndrisP
    AndrisP

    Began Watching Show the array values as a radio button

    I want to pass my array as an input to the radio button field. I have an array of values, when I click a button, it should show me all …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in I have a problem with this script

    Your mistake is comma after `$_POST['JENIS_PERMINTAAN']`. If you want to handle as array `$_POST['JENIS_PERMINTAAN'], reverse_tanggal($_POST['TGL_PERMINTAAN'])` then include it in square brackets foreach([$_POST['JENIS_PERMINTAAN'], reverse_tanggal($_POST['TGL_PERMINTAAN'])] as $idx=>$val){
  • Member Avatar for AndrisP
    AndrisP

    Began Watching I have a problem with this script

    $query = "INSERT INTO TB_RADIOLOGI (ID_PASIEN, ID_PENDAFTARAN, TGL_PERMINTAAN, JENIS_PERMINTAAN) VALUES(?, ?, ?, ?);"; foreach($_POST['JENIS_PERMINTAAN'], reverse_tanggal($_POST['TGL_PERMINTAAN']) as $idx=>$val){ $params = array($_POST['ID_PASIEN'], $_POST['ID_PENDAFTARAN'], $val ); //--disini input id_pasien=0001 sesuai contoh di form …
  • Member Avatar for AndrisP
    AndrisP

    Began Watching prepared UPDATE statement with date

    Hello I'm trying to create an update statement where it updates inlever_datum with a date from now + 7 days later I already have this case "0": //doesn't work $id …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in prepared UPDATE statement with date

    Manage date in SQL query: $id = $_GET['id']; $sql = "UPDATE apparatuur SET inlever_datum = date(current_date()+7), uitleen_datum = NOW() WHERE id= ? "; $stmt = $conn->prepare($sql); $stmt->bind_param('i', $id); $status = …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in MySQL - automatically update row after5 min of inactivity (set expirat

    Create event in database [MySQL event create](https://dev.mysql.com/doc/refman/8.0/en/create-event.html)
  • Member Avatar for AndrisP
    AndrisP

    Began Watching MySQL - automatically update row after5 min of inactivity (set expirat

    Hi All Can anyone help me, if user inactivity and update my datbase row automaticlly ( I mean time set if user inactivity or browser close ) Before login $sql …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in problem with spaces in folder name

    and another question - why you do not use `pathinfo($file,PATHINFO_EXTENSION)` insead of `substr($file, strrpos($file, '.') + 1)` in line 4?
  • Member Avatar for AndrisP
    AndrisP

    Began Watching problem with spaces in folder name

    Hi guys I'm having a bit of a problem with php and linux. I'm using the following function, to find files with specific file extensions within a given folder and …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Copy bulk Files in Linux

    Do not need write script for this. Actually its a single line command e.g. You have directory `dir1` which contains multiple files and `dir2` which is target to copy `cp …
  • Member Avatar for AndrisP
    AndrisP

    Began Watching Copy bulk Files in Linux

    I have multiple files in a Linux systems where I want to copy them with a single cp command into a different path and directory. Should I write a bash …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in I need help with "before insert" Trigger

    a small correction to my post $ip = filter_input(INPUT_SERVER,'REMOTE_ADDR',FILTER_VALIDATE_IP); $stmt->execute([$ip,$ip,$ip]);
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in I need help with "before insert" Trigger

    You can insert all these values witout trigger e.g. use prepared statement: insert into download ( `ADDRESS` ,`ip_address` ,`vrefer` ) select ? ,inet_aton(?) ,(select id from `ip_lookup` where inet_aton(?) between …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in I need help with "before insert" Trigger

    Don't need `declare` - select values direct to fields DELIMITER // CREATE TRIGGER download_ins BEFORE INSERT ON download FOR EACH ROW begin set new.ip_address = inet_aton(new.`ADDRESS`); set new.vrefer=(select id from …
  • Member Avatar for AndrisP
    AndrisP

    Began Watching I need help with "before insert" Trigger

    I'm trying to create a trigger that does two things, first take an ip that's in dot notation and run inet_aton on it and put the result in another field. …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Extract ip_address from array and compare to data in table

    Get value from array by key `$temp['IP_ADDRESS']` but use of `between` in your code is wrong - should be convert by `INET_ATON`
  • Member Avatar for AndrisP
    AndrisP

    Began Watching Extract ip_address from array and compare to data in table

    I'm creating a report page and can't figure out how to convert the array (row) to just get the ip_address. I'm a newbie to php and can't figure out how …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Mysql query for sum two table data by product wise

    get totals: select ifnull(t.product_id,'Total') product_id ,sum(t.sale) sale ,sum(t.purchase) purchase from ( SELECT I.product_id, ifnull(S.sale, 0) AS sale, ifnull(P.purchase, 0) AS purchase FROM product I LEFT JOIN ( SELECT product_id, SUM(quantity) …
  • Member Avatar for AndrisP
    AndrisP

    Gave Reputation to nishita_1 in Mysql query for sum two table data by product wise

    DEAR AndrisP, Thanks for your reply. i am already solve this problem using below code. SELECT I.product_id, COALESCE(S.sale, 0) AS sale, COALESCE(P.purchase, 0) AS purchase FROM Product I LEFT JOIN …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Mysql query for sum two table data by product wise

    Sorry suquery will have to be used here but your join is incorrect - for first select all product ID's from product table then join sale and purcase select p.product_id …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Mysql query for sum two table data by product wise

    For first check correct result using separate queries: select product_id, sum(quantity) from pur_item group by product_id; select product_id, sum(quantity) from order_item group by product_id; and i recommend do not use …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in Mysql query for sum two table data by product wise

    I recommend use `join` instead of `subquery` if possible because join works faster. I think you have another table e.g. `products` which contains all product id. Select `product_id` from products …
  • Member Avatar for AndrisP
    AndrisP

    Began Watching Mysql query for sum two table data by product wise

    Dear sir, Please help me about below query. here is two table sale and purchase. i want product wise result in output table like below picture. please help me ![22222.jpg](/attachments/large/4/f8a1f4cfc8eaaad4bde70a850826b310.jpg)
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in INSERT INTO with LAST_INSERT_ID()

    I'm not sure you can get it exactly. Oracle DB and Postgres have a returning clause e.g. `insert into table(id,val_1,val_2) returning id into variable;` but MySQL doesn't
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in INSERT INTO with LAST_INSERT_ID()

    E.g. drop table if exists test_table; create table test_table( id int not null auto_increment primary key ,test varchar(30) null ,unique key (test) ); insert into test_table(test) values('1 sample string'); insert …
  • Member Avatar for AndrisP
    AndrisP

    Replied To a Post in INSERT INTO with LAST_INSERT_ID()

    Its id who you try to insert as duplicate - result is no changes and supress error message

The End.