Posts marked with "MySQL" 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]

Auto Login Without Form in phpMyAdmin

If you’re using **phpMyAdmin **(PMA), you know that every time you use the application, you have to log in and when the cookie expires, you have to log in again. It’s an annoying thing to log in every time for a developer who needs to do work fast. There is a way to stop this annoying thing. It’s by disabling the login form and auto login when you visit phpMyAdmin.

... [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]

MySQL NOW() in JavaScript (UTC & Local)

If you know MySQL, you will certainly know the NOW() function that outputs the current date and time with the timezone of the MySQL server. For easy use and compatibility, we use UTC time zone for storing time in database. If you are running a web app that comply with MySQL, then you need the date function as same as the NOW().

So, I will give you a small function that return the same value as MySQL’s NOW() function in both UTC and local time. There are 2 versions of this function, one little big and the other very short (1 line of code). The shorter one is supported by modern browsers and the other is supported by all browsers.

... [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]

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