Latest Web Development Posts

hi good day guys,
i'm having a trouble with fetching the data i have a list of folder outside like in the picture below


when i click the first folder the picture below shows the output it has duplicates


i want to know what's the problem with my code why it duplicates the folders. can someone help me out. please... thank you in advance

here's my code



Try this code :

const date1 = new Date('7/13/2010');
const date2 = new Date('7/18/2010');
const diffTime = Math.abs(date2 - date1);
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); 
Biiim 116 Junior Poster

I've been working on a project using Morris JS and since there was no solution out there for the Y axis scaling that I could find I wanted to posted where I got.

Note you will need morris JS & Moment JS to run it.

You just need a div with the id "home_chart_0" and it should run. It rounds the max value up, compares it to the min value rounded down and divides it by 10 and spreads over 10 lines.

The properties "yLabelFormat" & "numLines" in Morris JS are not documented but exist.

Let me know if you have something worked out on the Y scaling.

var ajaxData.weekending = moment();
var graphData = [
    {period: moment(ajaxData.weekending).clone().subtract(7,'d').format("Y-MM-DD"), value: 20, quota: 10}
    ,{period: moment(ajaxData.weekending).clone().subtract(6,'d').format("Y-MM-DD"), value: 30, quota: 20}
    ,{period: moment(ajaxData.weekending).clone().subtract(5,'d').format("Y-MM-DD"), value: 53, quota: 30}
    ,{period: moment(ajaxData.weekending).clone().subtract(4,'d').format("Y-MM-DD"), value: 61, quota: 40}
    ,{period: moment(ajaxData.weekending).clone().subtract(3,'d').format("Y-MM-DD"), value: 64, quota: 50}
    ,{period: moment(ajaxData.weekending).clone().subtract(2,'d').format("Y-MM-DD"), value: 68, quota: 60}
    ,{period: moment(ajaxData.weekending).clone().subtract(1,'d').format("Y-MM-DD"), value: 80, quota: 70}
    ,{period: moment(ajaxData.weekending).format("Y-MM-DD"), value: 85, quota: 80}

var graphYMAX = 85;
var graphYMIN = 0;

var graphPlotYMIN = 0;
var graphPlotYMAX = 0;
var graphPlotYDIFF = 0;
var graphYPlotNumLen = 0;
var graphYPlotRounder = 0;
var graphYPlotNumTop = 0;

if(statUpsidedown == 1){
    graphPlotYMIN = graphYMAX;
    graphPlotYMAX = graphYMIN;
    graphPlotYDIFF = graphPlotYMIN - graphPlotYMAX;
    graphYPlotNumLen = Math.ceil(Math.log10((graphPlotYDIFF) + 1));
    graphYPlotRounder = (10**graphYPlotNumLen)/10;
    graphYPlotNumTop = Math.ceil(graphPlotYMAX/graphYPlotRounder)*graphYPlotRounder;
    graphYPlotNumBot = Math.floor(graphPlotYMIN/graphYPlotRounder)*graphYPlotRounder;
    graphPlotYMIN = graphYMIN;
    graphPlotYMAX = graphYMAX;
    graphPlotYDIFF = graphPlotYMAX - graphPlotYMIN;
    graphYPlotNumLen = Math.ceil(Math.log10((graphPlotYDIFF) + 1));
    graphYPlotRounder = (10**graphYPlotNumLen)/10;
    graphYPlotNumTop = Math.ceil(graphPlotYMAX/graphYPlotRounder)*graphYPlotRounder;
    graphYPlotNumBot = ...
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in F:\xampp\htdocs\ajax\server.php on line 55
// Retrieve comments from database
$sql = "SELECT * FROM comments";
$result = mysqli_query($conn, $sql);
$comments = '<div id="display_area">'; 
while ($row = mysqli_fetch_array($result)) {
$comments .= '<div class="comment_box"> <span class="delete" data-id="' . $row['id'] . '" >delete</span> <span class="edit" data-id="' . $row['id'] . '">edit</span> <div class="display_name">'. $row['name'] .'</div> <div class="comment_text">'. $row['comment'] .'</div> </div>';
$comments .= '</div>';


Sorry no. But I did read and it appears you have to configure a data source through the ODBC Administrator. I didn't see you mention this work.

Magic8Computing Newbie Poster

Does anybody know how i can connect a PHP web site to an OpenEdge Progress Database.

I have the following as a connection file that when I run it does not error but there is also nothing to say it has connected either.

I have System DSN 32bit ODBC connection call Live_Vision that I am calling.


  if ($conn_id=odbc_connect("Live_Vision","vision","vision", SQL_CUR_USE_ODBC)){

    echo "connected to DSN";

    if($result=odbc_do($conn_id, $sql)) {

    } else {

      echo "can not execute '$sql' ";


    echo "closing connection $conn_id";


    } else {

      echo " can not connect to DSN";


Just for clarity, doesn't seem to mean there is delay. Since this appears to be dependent on the user's phone, PC or such maybe the issue is not your code.

how to play multiple video in hero image without any delay ?

I haven't used this program myself, I would go through this guide on the Openelement Wiki:

Wiki Openelement Publishing Settings

PHP code is a scripting language ran on the webserver(Pre-Hypertext Processing, IE it processes Hypertext(HTML) before it is sent to the browser), so you will have to upload it to the webserver to run the PHP script. Open Element probably is just missing the FTP settings so it can connect and upload the files to the right folder on the server and then it will also need to know what the actual web address is to view the processed file after it is uploaded.

elamigosam Light Poster

I have a Google map and a image lightbox slide show in the same page.
After the page loads, the images and the map get loaded.
map works normal.
After I click on the image to make it bigger (lightbox) and then exit, the map is froozed and iresponsive.

here is a link to a fiddle sample of it:

I was thinking to renaming all the functions, but not sure if that would do anything.
also no errors in chrome console, and all the files load ok.

P.S. I am not a javascript programer, but do understand basics.

The cause of the problem was: no prefix. n should be $n. So that's that with the code.

Problem 2 is: I can't upload the files to an FTP server.


With this code:

echo( "Hello universe" );
for( n = 0; n < 5; n++ ) {

With 'preview' I get this:

Parse error: syntax error, unexpected '=', expecting ';' in E:\Web\OpenElement PHP\index.php on line 22

And when I upload the code, I get this:

You don't have permission to access this resource.

Which has to get to do with uploading through FTP. I think I'lll solve that one myself.


OpenElement allows you to preview pages with a webserver function. This way it works a little bit, not completely. By publishing the pages on a domain it doesn't work at all. I suspect that this has to do with the FTP function.


My question is this:

I'm trying to practice PHP. I use OpenElement as my editor. You can get to know this program through this website: Problem is: when I preview the page (with PHP in it) it doesn't display text produced by PHP, but instead it produces the PHP code itself. Do you know OpenElement, and if you know it, do you know how to make it run PHP the way PHP should ben run?


Leon (joh)

here is my table data..

here is my table data..

(4 Columns/1row in mysql table)

id                 bno                            date                      results
310                001                02-15-2020               MI,108.53

How to split(statemiles) single column into (state, Miles) two columns and output like following 5 columns /4rows in mysql using php code.

(5 Columns in mysql table)

id                  bno                             date                  result1     result2

310                001                02-15-2020               MI          108.53

310                001                02-15-2020           Oh          194.57

310                001                02-15-2020           PA          182.22

310                001                02-15-2020           WA          238.57

Following php code split two columns perfectly..
(screenshot below)



$comma = preg_replace('/,\\s*/', "', '", $_POST["stateandmileslist"]);
$row = preg_replace('/\\n/', "'), \n('", $comma);
$query = "insert into tis_satesmiles (states, miles) values ('" . $row . "')";
$statement = $dbh->prepare($query);

But how can i update or insert order_no and order_date input values in same table?

Following attachment shown form page how users submit values


While I can't guess why you need this. Why not try it? Sendmail for me has worked alongside other mail systems for a very long time since sendmail as in the command line stands on its own.

I wonder if you are encountering some other issue such as this Google reveals?

darren2005 Junior Poster in Training

Hi, quick question as I was wondering if I could setup PHPMailer and Sendmail both on the same Apache server? Wasn't sure if Apache would only allow one?

Thanks in advance

Dani 1,932

Thank you so much for apologizing! I really appreciate it.

In my situation, the JavaScript route was a better option because it only loads the additional CSS required to design the desktop-only code editor upon triggering an open event of the code editor via JS. This saves kB for both desktop and mobile users who are just forum lurkers.

jkon 506

Dani obviously the "don't know anything about web development" was an exaggeration. I hear (and read) sometimes false , stupid or even dangerous things about web development or programming that are not based in any facts , the few times I have asked the person with the so strong (false) opinion if have tried out that by themselves I often get variations of the answer (No but everyone says so , I have read it from X that I trust). That is why I consider important in these forums not to replicate false opinions , especially by a member (founder) of your status. In this situation you tried it (or read the doc better) and you realized what is actually true , and I apologize for using that phrase. 

Hello, i have the following code:


<form role="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<label for="products">Product</label>
<select id="products" name="products" class="user">
    require 'data.php';
    $products = loadProducts();
    foreach ($products as $product) {
    echo "<option id='".$product['id']."' value='".$product['id']."' selected>".$product['name']."</option>";
<label for="bundles">Bundle</label>
<select id="bundles" name="bundles">


    <script type="text/javascript">
                var aid = $("#products").val();
                    url: 'data.php',
                    method: 'post',
                    data: 'aid=' + aid
                    bundles = JSON.parse(bundles);
                        $('#bundles').append('<option>' + + '</option>')


        require 'DbConnect.php';

        if(isset($_POST['aid'])) {
            $db = new DbConnect;
            $conn = $db->connect();

            $stmt = $conn->prepare("SELECT * FROM bundles WHERE pid = " . $_POST['aid']);
            $bundles = $stmt->fetchAll(PDO::FETCH_ASSOC);
            echo json_encode($bundles);

        function loadProducts() {
            $db = new DbConnect;
            $conn = $db->connect();

            $stmt = $conn->prepare("SELECT * FROM products");
            $products = $stmt->fetchAll(PDO::FETCH_ASSOC);
            return $products;

    <label for="bundles">Bundle</label>
    <select id="bundles" name="bundles">

Now what i need is to how can i display the selected value in index.php because based on the values from the 2 lists i need to get a different value from a different table for example ( first list selected value is: prodname and second list selected is 7 now i need the 2 values to get a 3'rd value which is = prodname7)

Here's something to start with:

$(function() {
    $("table tr").each(function() {
        var tdValues = [];
        $(this).children().each(function() {

        // here you can use tdValues to check whether the values contain what you need
        // and assign a style to $(this)


How to make row that have different value with color red font to full row ?

I have html dynamic table not static meaning i dont know how many rows or column inside

table because it changed based on data show from back end .

I need to give color red to row have distinct value

according to my case then second row and third row will be

have font red and first row will not be change color .

First row have similar value as 12 on all td so that color will not change .

But second row have distinct value or different value 15 so that will be red font to full

row completely .

third row have distinct value or different value as 17,15,13,12 so that third row

completely will have red font .

meaning if I have one value or more different value from each other on same row

then full row or all td on tr will be change font to red .

Actually i need function jquery or javascript give row that have different value with

color red to full row ?

can you please help me on that ?

<!DOCTYPE html> <html> <body> <table border="1"> <col width="500"> <col width="500"> <col width="500"> <col width="500"> <tr bgcolor="#6699FF" width="100%"> <th>Part1</th> <th>Part2</th> <th>Part3</th> <th>Part4</th> <tr> <td>12</td> <td>12</td> <td>12</td> <td>12</td> </tr> <tr> <td>12</td> <td>15</td> <td>12</td> <td>12</td> </tr> <tr> <td>17</td> <td>15</td> <td>13</td> <td>12</td> </tr> </table> <button id="button">Click Me</button> </body> </html>
Dani 1,932 The Queen of DaniWeb

I have always known that urlencode() encodes spaces as plus signs and rawurlencode encodes spaces as %20. However, I always struggled to know when to use which. I just finally learned today that you should use rawurlencode() if encoding URI paths and urlencode() if encoding query strings. Who woulda thunk it would be that simple?! :-P

i tried this code and it did not move the arrow keys. i just copied and pasted this and it did not move the arrow keys, is there something Im not doing?

Dani 1,932

Oh sorry. I see you’re using Magento. Sorry for asking if you’re using a framework. I was tired when I read your post.

Dani 1,932

I just checked your Github repository and it seems you’re using a PHP framework. Does it log errors anywhere? Does your web server log errors already anywhere?

Dani 1,932

A blank page means that there is a fatal error and the page cannot load. Here is some code I wrote so you can log these errors to a file and see what the error is so you can fix it.

I am using Magento (Ver 1.9.x)

If i try with my localhost success url like, and return success message with order id.

if i try with live, success url like, success page like blank page.

How to solve the issue?

Code :

I have a basic html here, where you could just submit the button through an action page, so it inserts the record into the mysql database in phpmyadmin, what I want to know is how to make it auto submit after 5 mins, while setting the blanks fields value into "0" in the database. I am currently using wamp as my local server. Is there a best way how to do this? like using javascript or ajax?

this is the html code

<h2><font size="6s">GHS Applicant Assessment Tool</font></h2> <h5><font size="5s"><p>This exam is an assessment tool to help us place you 

in the correct account. 

</p></font></h5> <p style="color:red;">* Required</p><br> <form name="quiz" id="myquiz" onsubmit="return validate()" method="post" 

action="/ghs/ghsadd.php"> <font size="5">Last name*</font><br> <input type="text" name="last_name" required><br> <font size="5">First name*</font><br> <input type="text" name="first_name" required><br> <font size="5">Middle Initial</font><br> <input type="text" name="middle_initial" required><br> <font size="5"><p class="thick">Highest Educational Attainment*</p></font> <font size="5"><input type="radio" name="educ_attain" value="hsalsgrad" 

required> High School 

Graduate / ALS Graduate<br> <input type="radio" name="educ_attain" value="shsgrad" required> Senior High 

School Graduate<br> <input type="radio" name="educ_attain" value="undergrad1" required> College 

Undergraduate 1 year<br> <input type="radio" name="educ_attain" value="undergrad2" required> College 

Undergraduate 2 years<br> <input type="radio" name="educ_attain" value="undergrad3" required> College 

Undergraduate 3 years<br> <input type="radio" name="educ_attain" value="undergrad4" required> College 

Undergraduate 4+ years<br> <input type="radio" name="educ_attain" value="collegegrad" required> College 

Graduate<br> </font><br> <hr> <font size="5"><p class="thick">Logic and Reasoning</p></font> <p>You will be given 5 minutes to complete this portion.</p><br> <font size="5"><p>The 4:25 P2P bus takes 1 hour and 45 minutes to arrive in 

Trinoma. If Joseph takes this bus, what time will he arrive in Trinoma? *</p> <input ...

Try this query :

select name,count(name) as Total from Table_name group by name