Thursday, 30 May 2019

Use Of MySQL Where Clause in php 7.3

The WHERE clause is used to extract only those records that fulfill a specified condition.
where clause is a part of select command . it is used to fetch data from a table . we basically use this clause to filter out our results. by using where clause we can select particular set of records based specified condition.

create database name dbname
table name :  empInfo
column : id , name , eid,mob

create connection.php page


$con=mysqli_connect("localhost","username","password","dbname") or die(mysqli_error());


create index.php 



?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">


<title>page title</title>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<link href="style.css" rel="stylesheet" type="text/css" />

<style type="text/css">


.style4 { color: #0066CC;

font-weight: bold;

font-size: 16px;








                      //select values from empInfo table where column=value

                     $data="SELECT * FROM empInfo where emp_id=''";
echo "<table border='1'>";
echo "<tr><th>Emp_id</th><th>Name</th><th>Email</th><th>Mobile</th></tr>";

while(list($id,$name,$eid,$mob) =  mysqli_fetch_array($val))
echo "<tr>";
echo "<td>".$id."</td>";
echo "<td>".$name."</td>";
echo "<td>".$eid."</td>";
echo "<td>".$mob."</td>";
echo "</tr>";
echo "</table>";


                  <?php //}?>



Redirect http to https using .htaccess

Redirect your http page to https page using .htaccess file
create .htaccess file in your root folder and paste given code. Change red text to your domain name

<---- start code here ---->

RewriteEngine On
RewriteCond %{HTTP_HOST} ^sakhihosting\.in [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$$1 [R=301,L]

<---- end code here ---->

Redirect Specified Folder

If you want to force SSL on a specific folder, insert the code below into a .htaccess file placed in that specific folder:
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} folder
RewriteRule ^(.*)$$1 [R=301,L]

Make sure you change the folder reference to the actual folder name. Then be sure to replace your actual domain name and folder you want to force the SSL on.