Search Results

how to create search with php

Results across blog posts and JavaScript notes.

How to make your website searchable from the browser bar with OpenSearch

…n this blog, I have a search function next to the navigation menu. Here is how it works on the structural level. <form method="get" actio…e url is idiallo.com/search. This means when you enter a query like how to create search with php and press enter, this is what you will get…are like me, you like using shortcuts to get work done. The typical way to search for a video on YouTube is to first go to youtube.com wait …

https://idiallo.com/blog/search-website-with-opensearch

Published on | Views: 10236

Creating a simple search algorithm with PHP and MySQL

…vailable through search now. If you do want to handle your search in house however, then keep reading. Homemade Search Solution Before we go… { echo 'No results'; exit; } // Print page with results here. We created a simple search algorithm that can handle a fair amount o…Search is an important feature on a website. When my few readers want to look for a particular passage on my blog, they use the search box. …

https://idiallo.com/blog/php-mysql-search-algorithm

Published on | Views: 525304

How to create a Javascript Syntax highlighter

…ght here on my blog and until recently I wasn't really paying attention on how it looks. Since most of the time it is my code, I have no tro…*)/g; var htmlTagReg = /(&lt;[^\&]*&gt;)/g; var sqlReg = /\b(CREATE|ALL|DATABASE|TABLE|GRANT|PRIVILEGES|IDENTIFIED|FLUSH|SELEC…Most if not all IDEs come with syntax highlighting. It makes it easier to read your code and gives you less headache when debugging. Sometim…

https://idiallo.com/blog/javascript-syntax-highlighter

Published on | Views: 34589

SQL injection and how to protect your website

…uced to a commercial application, the damage can be very expensive. I like how stackoverflow users are fighting very hard to eradicate SQL i…tax. However, a clever user can easily manipulate the parameters to log in without having to the proper credentials. For example the user ca…d less on good talent. It is much cheaper to hire someone who just learned php a few weeks ago then a seasoned developer. But it becomes a v…

https://idiallo.com/blog/sqlinjection-and-sqlprotection

Published on | Views: 28687

Getting started with your first website: Part 2 - WordPress

…dit the wp-config.php file now to tell WordPress where our database is and how to log in. We will use Vim text editor to modify the file. If…ill be to setup an application that make use of all these technologies and create something useful. Our application will be a WordPress Blog…This tutorial is a follow up the previous post Getting started with your first website. On the previous tutorial we have selected a hosting …

https://idiallo.com/blog/creating-your-first-website-part-2

Published on | Views: 15654

How to Get Started Programming: Build a Blog

…The moment I learned how to program, I wanted to experiment with my new super powers. Building a BMI calculator in the command line wouldn't…write a JavaScript function that stitches together HTML strings. Maybe you create your own bizarre templating syntax. It will feel like magi…s just a text file you can open in any editor. But then I wanted tags, and search, and suddenly I was reinventing databases poorly. That's w…

https://idiallo.com/blog/get-started-programming-with-a-blog

Published on | Views: 2079

How to SEO in 2018 and Beyond

…t. I can stand on one leg, close both eyes and recite it backwards. That's how easy it is to recreate that coca cola formula. But knowing t…e leg, close both eyes and recite it backwards. That's how easy it is to recreate that coca cola formula. But knowing the secret recipe is … peers have always assumed that I know a weird little trick to game Google search results. Something I would type in a dark themed code edit…

https://idiallo.com/blog/seo-in-2018-and-beyond

Published on | Views: 8371

Making PHP as fast as a Web server to send files

…e I get a spike in traffic but now I serve all my static files with Nginx. However, there are times where you don't want to serve files dire…wn every time I get a spike in traffic but now I serve all my static files with Nginx. However, there are times where you don't want to serv…of security before serving it. How do you serve the files efficiently with PHP? There are many scenarios where you want to use PHP for the j…

https://idiallo.com/blog/making-php-as-fast-as-nginx-or-apache

Published on | Views: 33388

Getting started with your first Website

…r the default web root folder: /var/www/index.html You can edit it and see how the page updates in the browser. We didn't install all this j… Hostgator make it super easy for anyone to get started; they allow you to create a whole website without ever writing code. For most people…r easy for anyone to get started; they allow you to create a whole website without ever writing code. For most people, it is plenty to run a…

https://idiallo.com/blog/creating-your-first-website

Published on | Views: 19573

One of the reason people hate php

…sume that the fix will be not to use index that is not defined but here is how it was fixed: for($i=7; $i < 45; $i++){ if(!isset($arra…isset($array[$i])) $array[$i] = ${"p_name".rand(1,6)}; } Yes they randomly created 45 elements in the array. In case someone was to use inde… and there was an interesting bug fix i found. One developer was writing a search query for a page and used 6 variables since there were 6 v…

https://idiallo.com/blog/one-of-the-reasons-people-hate-php

Published on | Views: 15599

How to create DOM elements efficiently with JavaScript

…at obscures the background and asks the user to perform an action. Here is how you do it. First you create the HTML, give the overlay an abs…d and asks the user to perform an action. Here is how you do it. First you create the HTML, give the overlay an absolute position, and then …to the parent. These two very simple functions make it much easier to deal with DOM elements in JavaScript. Plus you don't have to worry abo…

http://idiallo.com/javascript/create-dom-elements-faster

Published on

How to use pushState without breaking the back button

…appy with their search result. So we only create one or two entries. Here how it is done: searchInput.onblur = function(){ let val = th…d it very annoying when I use an instant search field and each key I press creates a new state. What this means every single time I hit the …I find it very annoying when I use an instant search field and each key I press creates a new state. What this means every single time I hit…

http://idiallo.com/javascript/pushstate-the-proper-way

Published on

How to tell an element is in view using JavaScript.

…e a mistake and drain your website's performance. Let's break it down into how we can create a flexible function that doesn't freeze the pag…Recently, I've created a dynamic story where I wanted an event to trigger when an element is in view. The solution was simple, but it's easy… the function constantly. This can be achieved by hooking up this function with the scroll event. Here is how: window.addEventListener("scro…

http://idiallo.com/javascript/how-to-detect-element-in-view

Published on

Ajax without jQuery

…at I rely on it entirely for some tasks. The more I use, the more I forget how to manually make stuff. How do you make an HTTP request witho…s, instead it relied on ActiveX. So we have to make sure to test before we create the object. var isActiveX = !!window.ActiveXObject, xh… more I forget how to manually make stuff. How do you make an HTTP request without jQuery? jQuery took all the complexity out of the equatio…

http://idiallo.com/javascript/ajax-without-jquery

Published on

Every statement must end with a semicolon;

…ment ends and add the semicolons dynamically and correctly parse the code. However, there are times where the interpreter can fail and creat…arse the code. However, there are times where the interpreter can fail and create chaos for you. Here is a bug that hunted me for days. (fun…g to figure out what the problem was. If I had simply ended each statement with a semicolon, I would be a happier man. So here is the fix: (…

http://idiallo.com/javascript/end-statment-with-semicolon

Published on

Complex function call delays without nesting in JavaScript

… to play an animation before I remove the element from the page. Let's see how we can do that with setTimeout. function victoryDance(element…t before the next action. To use the then() function, all we have to do is create a Promise. Here is the code. // Nesting it inside util for…on before I remove the element from the page. Let's see how we can do that with setTimeout. function victoryDance(element) { // start th…

http://idiallo.com/javascript/delay-callbacks-and-promises

Published on

Creating a router in JavaScript for Nodejs

…s ago and I hardly ever look at the code that runs the framework. Recently however I have been experimenting with Nodejs and I needed a rout… request. Some urls only works if they are POST requests. Routing We will create a function route that will take a url as a parameter and w…pe on this website are handled through one script. It is a common standard with many framework. The script in question is called a Router. I…

http://idiallo.com/javascript/how-to-create-a-router

Published on

The whole page just went blank

…y languages. All it does is print a text on the screen. But then you learn how you can cleverly use it in different parts of your page. <…dress is <span id="email-placeholder"></span></p> Now we created a place holder with an ID that JavaScript can access prog…ddress is email@example.com This is a common tutorial for getting started with JavaScript. Unfortunately, one of the following thing you wi…

http://idiallo.com/javascript/page-goes-blank

Published on

How to use JavaScript Call and Apply methods

… no more, by the time you are done reading this page you will know exactly how they work and you will tell that interviewer how it is. :B Fi…traditional way of calling it will be: myFunction(); // an annoying pop up with the text "You called?" // But you can call it with apply m…

http://idiallo.com/javascript/how-to-use-call-and-apply-in-js

Published on

Accessing URL parameters in JavaScript

… // bar I wish JavaScript had a similar API but we since it doesn't we can create it. We can create a GET variable where we can access each …JavaScript, all the URL parameters are available under the window.location.search property. For some reason, it includes the question mark. …I have worked with PHP extensively and it is very convenient to have all the URL parameters automatically assigned to the global array $_GET…

http://idiallo.com/javascript/accessing-url-parameters

Published on