Google search

Basic and advanced computer skills like Excel with macros, How to speed up your PC, C, CPP, Java programming, HTML, JavaScript, PHP, Wordpress, all web tools, Android tutorials, MySQL Tutorials, WAMP server installation. etc.

Password recovery example using php from MySQL

To retrieve the password from your MySQL Database with using PHP script.

Step 1 : Create a table called "users" in your MySQL database with following structure for the same.






Step 2: Create a configuration file called 'config.php' which contains connection string and local host / remote server path.

<?php
$connection = mysql_connect('localhost', 'root', '');
if (!$connection){
die("Database Connection Failed" . mysql_error());
}
$select_db = mysql_select_db('mars_db');
if (!$select_db){
die("Database Selection Failed" . mysql_error());
}
?>


Step 3: Now create a 'forgotpassword.php' page with following code in it.
<center>
<h2 style='background-color:skyblue; color:blue'> 

Password recovery page </h2>
<hr>

<?php error_reporting (E_ALL ^ E_NOTICE); ?>

<?php session_start();
include"config.php"; 
if (isset($_POST['username'])){
    $username = $_POST['username'];
    $query="select * from users where 

usernm='$username'";
    $result=mysql_query($query);
    $count=mysql_num_rows($result);
    if($count==1)
    {
        $rows=mysql_fetch_array($result);
        $pass  =  $rows['password'];
        echo "<b><p 

style='background-color:green; color:yellow'>your 

password is::".($pass)."";
        $to = $rows['usernm'];
}
}
?>

<html>
<head>
<title>Password recovery page</title>
</head>
<body>
<form action="" method="post">
        <label> Enter your User Name / Email 

Id : </label>
        <input id="username" type="text" 

name="username" />
        <input id="button" type="submit" 

name="button" value="Submit" />
    </form>

<b><p style='background-color:khaki; 

color:teal'><marquee  onmouseover='stop()' 

onmouseout='start()' > Password recovery demo page 

</marquee> </p>

</body>
</html>


Step 4: Run the program to recover the forgot password.










Step 5: After entering existing user id, the following password is retrieved from your database.








You can also refer other advanced php programs here

Thank you for referring above example!

Gantt chart and PERT Chart

1. A Gantt chart:
A Gantt chart is developed as a production control tool in 1917 by Henry L. Gantt, an American engineer. Gantt chart is frequently used in project management, this chart provides a graphical explaination of a schedule that helps to plan,research, analyse, coordinate, and track specific tasks in a project.

To create Gantt chart, the various parameter must be considered in a project and this chart can be created using many tools and one such tool is MS Excel and here is an example of that Gantt chart. 












You can also browse more about Gantt Chart here

2. PERT CHART:
A PERT chart is a project management tool used to plan, Schedule, organize and coordinate tasks within a project. 

PERT stands for Program Evaluation Review Technique. 
This chart can be created using many tools and one such tool is MS Excel and here is an example of that PERT chart.









You can find more here 

MIT India Tech Blog: Submit checkbox value to MySQL

MIT India Tech Blog: Submit checkbox value to MySQL: Submit checkbox value to MySQL Below example states that checkbox values can be stored into MySQL database using PHP program. Step 1...

Submit checkbox value to MySQL

Submit checkbox value to MySQL

Below example states that checkbox values can be stored into MySQL database using PHP program.

Step 1: Create a table in MySQL with following screen shot. (Table name : Booked_Status)



 





Step 2: Create connection string / configuration page as following example and name it 'config2.php'
<?php
      $host="localhost";
      $username="root";
      $password="";
      $dbname="demo";
      $con=mysql_connect("$host","$username","$password");
      mysql_select_db("$dbname",$con);
?>

Step 3: Now create a main page called 'checkbox2mysql.php' with following code in it.
<html>
<head> 
</head> 
<body>
 <h2>Submit checkbox value to MySQL database in php</h2>
 <form method="post" action="">
Register No: <input type=text name=t1>
<br>
 <input type="checkbox" name="chk[]" value="Booked"><label>Booked</label><br/>
 <input type="checkbox" name="chk[]" value="Pending"><label>Pending</label><br/>
 <input type="checkbox" name="chk[]" value="Rejected"><label>Rejected</label><br/>
 <input type="submit" name="submit" Value="submit">
</form>
</body>
</html>

<?php error_reporting (E_ALL ^ E_NOTICE); ?>
<?php
include 'config2.php';
$t1=$_POST['t1'];

$query=mysql_query("select * from booked_status where regno='".$t1."' ") or die(mysql_error());
$duplicate=mysql_num_rows($query);

if (isset($_POST['submit']))
{
$chkbox = $_POST['chk'];
$i = 0;

if($duplicate==0)
    {

While($i<sizeof($chkbox))
{
$query = "INSERT INTO booked_status (regno, status) VALUES ('$t1','".$chkbox[$i]."')";
mysql_query($query) or die(mysql_error());
$i++;
}
echo "<center><h2 style='background-color:green; color:white; display:inline'><span>Successfully updated.</span>";
 }
 else
    {
      echo "<center><h2 style='background-color:red; color:white; display:inline'><span>The Register No. '$t1' is already present in the booking table";
    }
}
?>


Finally, run the above program and see the following output. 











If you run the above program with same Reg Number more than once, it will show following alert message.








That's all for now! Thank you for referring my blog and don't forget to share this with others!
Happy Coding!



Short term courses by IIM's

Short term professional courses for working people / executives from prestigious institutes like IIM's (Indian Institute of Management).

1. IIM Ahmadabad   
2. IIM Trichy 
3. IIM Calcutta
4. IIM Bangalore
5. IIM Shillong
6. IIM Rohtak

one can also find list of all IIM's Executive / MDP program from NIIT Imperia through synchronize learning at your own city and without leaving current yous job or assignments.

Here is a link for NIIT Imperia



Inserting radio button value to mysql database through php script

In the below example shows that  "Inserting radio button value to mysql database through php script"  

Before we begin let us understand brief about radio buttons, radio buttons are used to select single value from a group or it is for single selection or true / false type of values. 

Step 1 : Create table as following screen shot in MySql database with all fields set to varchar type.





Step 2 : Create a configuration file for connection purpose as following and name it config2.php (as per my example)
<?php
      $host="localhost";
      $username="root";
      $password="";
      $dbname="demo";
      $con=mysql_connect("$host","$username","$password");
      mysql_select_db("$dbname",$con);
?>

Step 3:  Create main html/php page to display radio buttons and name it "radio2mysql.php" and follow the below code.


<html>
<head> 
</head> 
<body>
<center>
<table style="border: 1px solid yellowgreen;">
 <h2>Inserting Radio button value to MySQL database in 
php</h2>
 <form method="post" action="">
<tr> 
<td> Register No: </td> <td> <input type=text 
name=t1> </td> </tr>
<tr><td>  <input type="radio" name="status" 
value="Booked">Booked 
 <input type="radio" name="status" 
value="Pending">Pending </td> </tr>
<tr> <td> 
<input type="submit" name="submit" Value="submit"> 
</td> </tr> </table>
 </form>
 </body>
</html>
<?php error_reporting (E_ALL ^ E_NOTICE); ?>
<?php
include 'config2.php';
$t1=$_POST['t1'];
$st=$_POST['status'];
$query=mysql_query("select * from booked_status where 
regno='".$t1."' ") or die(mysql_error());
$duplicate=mysql_num_rows($query);
if (isset($_POST['submit']))
{
if($duplicate==0)
   {
$query = "INSERT INTO booked_status (regno, status) 
VALUES ('$t1','$st')";
mysql_query($query) or die(mysql_error());
echo "<center><h2 style='background-color:green; 
color:white; display:inline'><span>Successfully 
updated.</span>";
 }
 else
    {
      echo "<center><h2 style='background-color:red; 
color:white; display:inline'><span>The Register No. '$t1' is 
already present in the booking table";
    }
}
?>

Step 4: Output of the above program is...








Step 5: After successful submit with register number and radio button value following output can be generated. 

Step 6 : After unsuccessful submit with register number and radio button value following output can be generated(duplicate values). 

Thank you for referring above example!