Posts marked with "SQL" in categories

Set Same Time Zone in PHP & MySQL

Time Zones are important if you’re creating a social app which will include chat, social network and others which is interacted with the society.

There are many time zones and you have to choose one to set in your server. I would totally recommend using UTC instead of your time zone in server.

Web Server and Database server are different and they each have their own configuration. This includes the time zone too. In this short post, I’m going to show how you can set the same time zone in both of these servers.

... [READ MORE]

Create a Search Engine In PHP, MySQL | Part 3

This is the Part 3 of “How To Create A Search Engine In PHP”. In this part, We make additional adjustments and make the search engine more awesome and cool.

Bot Page

Our crawler leaves a mark on every pages it visit. In other words a custom User Agent String goes with each requests to web pages. In the previous part, we set the user agent string as :

DingoBot (http://search.subinsb.com/about/bot.php)

We add a URL with it, because if the site owner sees this in their stats, they would think “what’s that ?”. So, to answer that question we add our bot info link. Also to promote our site.

... [READ MORE]

Create a Search Engine In PHP, MySQL | Part 2

This is the Part 2 of “How To Create A Search Engine In PHP”. In this part, We’ll add code to files that are being displayed to the users. We make the database and the table in this part.

index.php

The main page of our Web Search is index.php. It has a simple design and is not very advanced as Yahoo or something else.

<?include("inc/functions.php");?>
<html>
 <head>
  <?head("", array("index"));?>
 </head>
 <body>
  <?headerElem();?>
  <div class="container">
   <center>
    <h1>Web Search</h1>
    <form class="searchForm" action="search.php" method="GET">
     <input type="text" autocomplete="off" name="q" id="query"/>
     <div>
      <button>
       <svg class='shape-search' viewBox="0 0 100 100" class='shape-search'><use xlink:href='#shape-search'></use></svg>
      </button>
     </div>
     <p>Free, Open Source & Anonymous</p>
    </form>
   </center>
 </div>
 <?footer();?>
 </body>
</html>

We use simple functions for every files. head() function accepts two parameters. The first parameter is the title of the web page. The main site title will automatically be appended to the title you give in the first parameter when it’s displayed as .

... [READ MORE]

Create A Search Engine In PHP, MySQL | Part 1

When we all search on the web using Google, Yahoo or Bing, we are curious about how it works and how it gets all the information on the web. When us programmers started coding, we all wanted to create a search engine. I too attempted to create a search engine and I ultimately failed (3 years back). But now, I improved my coding skills, improved my knowledge and ideas. So, I decided to create a new search engine with automatic crawling, indexing and stuff.

... [READ MORE]

Create A Trending Box In PHP With MySQL & HTML

Trending boxes can be seen is social networks. Facebook, Twitter, Google + have it. Why not create one of your own. You can create your own using HTML and add styling by CSS. We will use PHP for updating most searched queries in MySQL database.

How the trending box looks like :

Trending Box

Trending Box

We need a table for storing the search queries. For this we are going to create a table named “trends”. Execute this SQL code to create the table

... [READ MORE]

Add Pagination To MySQL Database Result In PHP

Pagination makes the results tidy and simple. When there are many results, pagination helps sorting them out and adding each results to specific pages. In PHP, it’s real simple. You can use this tutorial to add a pagination to your database results in PHP.

We will be using PDO for database connection and queries. The Database table named “users” is like this :

<td>
  First_Name
</td>

<td>
  Last_Name
</td>
<td>
  Subin
</td>

<td>
  Siby
</td>
<td>
  Peter
</td>

<td>
  Charles
</td>
<td>
  Thomas
</td>

<td>
  Chacko
</td>
id
1
2
3

It contains more and more data. It’s just a sample. Let’s move on.

... [READ MORE]

Create Group Chat In PHP With MySQL, jQuery And AJAX

Chatting is one of the most implemented feature on websites. Group chat makes users to share their feelings and other news easily to their friends easily. AJAX makes this chatting more beautiful, elegant, simple and comfortable. Group chats may be vulnerable to SQL injections and XSS attacks. But in this post where we’re going to make a group chat that doesn’t have these vulnerabilities which makes it more awesome. You can see a demo, or you can download the files directly.

... [READ MORE]

Create MySQL Injection free Secure Login System in PHP

There were a lot of people who created tutorials to create a PHP Login System. But they were all vulnerable to MySQL Injection. In this post I’m going to demonstrate a login system free of this vulnerability. It is very secure. There are mysqli and PDO in PHP to escape these injections. We are going to use **PDO ( PHP Data Object **).

UPDATE – logSys

There is a new, free, better Advanced Login System which you can check out here.

... [READ MORE]

How to execute a PHP PDO prepared statement

PDO – a method used to execute SQL statements risk free. Fast, secure and easy when compared to mysqli and mysql functions in PHP.
A lot of newbies including me heard about PDO mostly in the 2010 – 2013 years when a lot of sites got hacked of Mysql Injection. PDO is the easiest and safest way to execute an SQL code, complete risk free.
In this post I’m gonna tell you how to execute a prepared statement in PDO and the common mistakes made by programmers which results an error while executing SQL code.

... [READ MORE]

Follow/Subscribe

Telegram 

Mastodon  Twitter

GitHub GitLab

Subdomains

Demos  Lab

Past

This blog was once on WordPress. Now a static site. See source code on

GitLab