Imamul.Hossain

Experience

170

0 Best Reply Awards

  • Member Since 2 Weeks Ago
  • 0 Lessons Completed
  • 0 Favorites

24th April, 2017

Imamul.Hossain left a reply on Ajax Table Update Inserts <br> In Database, Why? • 6 days ago

@Snapey, its not working

Imamul.Hossain left a reply on Ajax Table Update Inserts <br> In Database, Why? • 6 days ago

@Snapey , in script: input is like as follows:

<!DOCTYPE html>
<html>
<body onload="loadDoc('','demo')">

<h1>Input</h1>
<input type="text" id="givenInput" onkeyup="loadDoc(this.value,'demo')">
<br><br>
<h1>Output</h1>
<p id="demo"></p>
</body>
</html>

23rd April, 2017

Imamul.Hossain left a reply on Ajax Table Update Inserts <br> In Database, Why? • 6 days ago

@Snapey and @jlrdw , It is not laravel. It is atomic project for searching and editing a table using AJAX. I did not find any error but it inserts in database.

Imamul.Hossain left a reply on Ajax Table Update Inserts <br> In Database, Why? • 1 week ago

My code:

In class:

<?php
namespace App\W3School\SearchStudent;

use PDO;

class Student
{
    public $host = 'localhost';
    public $user = 'root';
    public $pass = '';
    public $db = 'student';
    public $conn = '';
    public $id = '';
    public $name = '';
    public $mobile = '';
    public $email = '';
    public $text = '';
    public $like = '';

    public function __construct()
    {

        try {
            $this->conn = new PDO("mysql:host=$this->host;dbname=$this->db", $this->user, $this->pass);
        } catch (PDOException $e) {
            echo $e->getMessage();
        }
    }

    public function setData($data = '')
    {
        if (array_key_exists('text', $data) and !empty($data)) {
            $this->text = $data['text'];
        }
        if (array_key_exists('id', $data) and !empty($data)) {
            $this->id = $data['id'];
        }
        if (array_key_exists('name', $data) and !empty($data)) {
            $this->name = $data['name'];
        }
        if (array_key_exists('email', $data) and !empty($data)) {
            $this->email = $data['email'];
        }
        if (array_key_exists('mobile', $data) and !empty($data)) {
            $this->mobile = $data['mobile'];
        }
        if (array_key_exists('like', $data) and !empty($data)) {
            $this->like = $data['like'];
        }
    }
 public function update()
    {
        $sql = "UPDATE `student` SET `name`=:name, `email`=:email, `mobile`=:mobile WHERE `id` = :id;";
        $getSql = $this->conn->prepare($sql);
        $result=$getSql->execute(array(
            ":name"=>$this->name,
            ":email"=>$this->email,
            ":mobile"=>$this->mobile,
            ":id"=>$this->id
        ));
        return $result;
    }
$obj = new Student();
$obj->setData($_GET);
if (!isset($_GET['text'])){
    $obj->update();
}

In AJAX:

 function update(id) {
        var name=document.getElementById('name'+id).innerHTML;
        var email=document.getElementById('email'+id).innerHTML;
        var mobile=document.getElementById('mobile'+id).innerHTML;

        searchPage = 'Student.php?id=' + id+'&name='+name+'&email='+email+'&mobile='+mobile;
        xhttp.open('GET', searchPage);
        xhttp.onreadystatechange = function () {
            if (this.readyState == 4 && this.status == 200) {
                document.getElementById("demo").innerHTML = this.responseText;
            }
        };
        xhttp.send();
    }

Imamul.Hossain left a reply on Ajax Table Update Inserts <br> In Database, Why? • 1 week ago

@jlucia I did not do what u r saying.

In class File:

22nd April, 2017

Imamul.Hossain started a new conversation Ajax Table Update Inserts <br> In Database, Why? • 1 week ago

From a Student table, when I click on a field and trying to update that field entry, it inserts '' after new data, why?

17th April, 2017

Imamul.Hossain left a reply on How To Remove Public From Laravel 5.4 • 1 week ago

@jlrdw I visited the link you provided......... and thanks for your courtesy..........

Imamul.Hossain left a reply on How To Remove Public From Laravel 5.4 • 1 week ago

@samalapsy I tried it several times, but no css or js is found.

@Snapey could you show me the proper ways, please please....

Finally, many many thanks to those persons who have come forward to help me......

16th April, 2017

Imamul.Hossain started a new conversation How To Remove Public From Laravel 5.4 • 1 week ago

I'm using laravel 5.4. I want to remove public from url. If I move .htaccess and index.php to root folder, no css or js is found. What can I do now?

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.