samedi 28 octobre 2017

How can i prevent horizental scrolling in mobile view when div move with jquery

i wrote some code to simulate papers for each page of my website but when you view it on gadget(mobile) devices when a div move(translateX) left screen scoll automatically with div to left then came back.

var width = divs.eq(currentDiv).width()+100;
$(".books-pages").css("transform" , "rotate(0)");
$(".main-menu").parent().css("transform" , "translateX("+width+"px)");
var menu = $(".main-menu").clone();
$("."+id).css("transform" , "translateX("+-width+"px)");

how can i prevent this scrolling?




Trying to UPDATE a database through HTML forms throws Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064

I am working on a project for school. I am new to PHP and databases, but managed to make a quite a good system for adding posts dynamically to my website. All is done with OOP aproach using the MVC framework and handling database is done through PDO. This is the add function, that works wonders and is called once user submits the HTML form:

public function add(){
    // Sanitize POST
    $post = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);

    if($post['submit']){
        if($post['title'] == '' || $post['content'] == '' || $post['link'] == '' || $post['image_name'] == ''){
            Messages::setMsg('Please Fill In All Fields', 'error');
            return;
        }
        // Insert into MySQL
        $this->query('INSERT INTO posts (country, language, title, content, link,  image_name) VALUES(:country, :language, :title, 
                    :content, :link, :image_name)');
        $this->bind(':country', $post['country']);
        $this->bind(':language', $post['language']);
        $this->bind(':title', $post['title']);
        $this->bind(':content', $post['content']);
        $this->bind(':link', $post['link']);
        $this->bind(':image_name', $post['image_name']);
        $this->execute();
        // Verify
        if($this->lastInsertId()){
            // Redirect
            header('Location: '.ROOT_URL.'shares/add');
        }
    }
    return;
}

The problem began, when I tried to do an editing system, for the posts in the database. When user is in admin mode, he can click a edit button, that redirects him to a URL with a queery, where the ID is written like this:

http://localhost/shares/edit/?id=2

Once user is on this URL, he has the option to input new values into the form, to owerwrite the current database row on that ID. (in the future, the form will be autofilled once you get redirected with the stuff on the ID)

This is the function edit:

public function edit(){
    // Sanitize POST
    $post = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);

    if($post['submit']){
        if($post['title'] == '' || $post['content'] == '' || $post['link'] == '' || $post['image_name'] == ''){
            Messages::setMsg('Please Fill In All Fields', 'error');
            return;
        }
        // Get ID from URL
        $url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
        $parts = parse_url($url);
        parse_str($parts['query'], $query);
        $id = $query['id'];
        // Insert into MySQL
        $this->query('UPDATE `posts` (`id`, `country`, `language`, `title`, `content`, `link`, `image_name`) VALUES(:id, :country, :language, :title, 
                    :content, :link, :image_name) WHERE id = :id');
        $this->bind(':id', $id);
        $this->bind(':country', $post['country']);
        $this->bind(':language', $post['language']);
        $this->bind(':title', $post['title']);
        $this->bind(':content', $post['content']);
        $this->bind(':link', $post['link']);
        $this->bind(':image_name', $post['image_name']);
        $this->execute();
        // Verify
        if($this->lastInsertId()){
            // Redirect
            header('Location: '.ROOT_URL);
        }
    }
    return;
}   

and it throws this error:

Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(`id`, `country`, `language`, `title`, `content`, `link`, `image_name`) VALUES('' at line 1 in C:\xampp\htdocs\classes\Model.php:43 Stack trace: #0 C:\xampp\htdocs\classes\Model.php(43): PDOStatement->execute() #1 C:\xampp\htdocs\models\share.php(27): Model->execute() #2 C:\xampp\htdocs\controllers\shares.php(18): ShareModel->edit() #3 C:\xampp\htdocs\classes\Controller.php(12): Shares->edit() #4 C:\xampp\htdocs\index.php(29): Controller->executeAction() #5 {main} thrown in C:\xampp\htdocs\classes\Model.php on line 43

I went through a lot of questions, that asked a similar question, but none helped me with debugging mine. Any help with debugging this function will get you my eternal thanks. :)




HTML 5 code to imput and submit a WEB FORM automatically

Hi I need to have this form (http://ift.tt/2xgMBdm ) be filled in and submitted automatically. It has to be html 5 code. How would I do it?

And if it is already “open” it should then not “open” it

Thanks A dumb programmer




Package bflows does not exist on NetBeans

Hi guys i'm making a web application with the jsp using netbenas, then my problem is the following: i have created some packages and i want to import them into my jsp page(SignUp.jsp) for i when i do i have this error.how do I fix this error?

ERROR:

enter image description here

SignUp.jsp

<%@ page contentType="text/html" %>
<%@ page session="false" %>
<%@ page buffer="30kb" %>
<%@ page errorPage="/ErrorPage.jsp" %>

<jsp:useBean id="UserManagement" scope="page" class="bflows.UserManagement" />
<jsp:setProperty name="UserManagement" property="*" />

Web application hierarchy

enter image description here




vendredi 27 octobre 2017

Inflated Size Webhost Fixed Ad? (on bottom)

What would cause this webhost ad to be so big? (on bottom) http://ift.tt/2ySwtlz

This is the size it is suppose to be? http://ift.tt/2gPHVHC

Would you think it is something in my code? I deleted all the code and then remade it.

Sorry if this is in the wrong section




Sticky footer in Material Components for Web?

How can I have a footer that stays at the bottom of the page using Material Components for Web?




Postioning text and button in a specific position over an image

i wanted to postion a text in (h1) on the image but it affected by the opacity of the image so how can i make it not to get affected by it, i want also to position the button directly under the text but it positiond under the image. the third problem is that there an empty space between the nav bar and div of (the text and the image) as it shown in the screen shot `screenshot of the webpage

@import url('http://ift.tt/2eZzRT2');

body{
    font-family: 'Quicksand', sans-serif;
    width: 100%;
}

.container-fluid {
    width: 100%;
    padding: 0px;
    
}

#top-header {
    text-align: center;
    background: #480000 ;
}
    
.inner {
  
  max-width:960px;
  margin: 0 auto;
  min-height: 50px;
}

.nav a {
    
    display: block;
    padding: 8px;
    color: white;
    padding-top: 15px;
}

.txt{

    top: 32%;
    left: 15%;
    font-size: 2.5vw;
    color: green;
    font-weight: bolder;
}

.main-img {
    opacity: 0.5;
    width: 100%;
    z-index: -1;
}


.btn {
    top: 40%;
    left: 20%;
}
<!DOCTYPE html>
<html lang="en">
  <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE-edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="http://ift.tt/2yYrQXn" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
      <script src="http://ift.tt/2iF8Hmw" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
      <title></title>
      <link href="http://ift.tt/2zcHM8r" rel="stylesheet">
      <link rel="stylesheet" href="stylesheet/style.css">
  </head>

  <body>
    <div class="container-fluid">
        <div class="row header row-fluid" id="top-header">
           <div class="inner">
               <nav class="nav topnav">
                <a href="#home">Home</a>
                <a href="#protfolio">Protfolio</a>
                <a href="#service">Serviice</a>
                <a href="#contact">Contact</a>
                <a href="#about">About</a>
               </nav>
            </div>
        </div>
        
        <div class="container-fluid main-div">
            <div class="row">
                <div>
                    <h1 class="txt col-md-4">We Know how to get your Job done</h1>
                    <img  class="img-fluid main-img" src="images/12.jpg" alt="main-image">
                    <a class="btn btn-primary" href="#">Pro</a>
                </div>
            </div>
            
        </div>
    </div>

 
      
  </body>

</html>

thank you in advance