Sunday, December 29, 2013

select_data_From_database

There is problem...when we create database and value insert into dataBase but when we want to fetch the data from database value is not retried so here I am Going to tell you how to select query used in PHP and how can we use it with html tags and PHP format....
so enjoy it...and if you face any problem then contact me .
here I am showing you where is the name of the table name and connection between table name and HTML tags  


 

Saturday, December 28, 2013

insert into Database

here I am going to tellyou how to connect database into php code and how to send Data into Databasethe following code shows you that connectivity and this is enter data into database....\


ther is a very important thing that the name of Database
name of table 
name of entity
name of name inot first page and name into html page  




index.php
<html>

<body>

<h1>A small example page to insert some data in to the MySQL database using PHP</h1>
 

<form action="insert2.php" method="post">
 

Firstname: <input type="text" name="fname" /><br><br>
Lastname: <input type="text" name="lname" /><br><br>
 

<input type="submit" /></form>
</body>
</html>

---------------------
 insert2.php


<html>
<body>
<?php

$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("DB_name", $con);                             //// database name
$sql="INSERT INTO nametable (firstname, lastname)  ////table name
VALUES  ('$_POST[fname]','$_POST[lname]')";   /////////////// name is same as into first page declared...
if (!mysql_query($sql,$con))                                      //////
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";
mysql_close($con)
?>
</body>

</html>

Friday, December 27, 2013

php Database connectivity

after a long time due to some problems I am a little bit not touche with...
there is wide network of PHP websites in the world. many programmer face there is a problem in connectivity with the DataBase so i write this blog for that guys....
so enjoye it...

<?php
session_start();
class add
{
    var $conn;
   
    function __construct()
    {
        $this->conn=new MySQLi("localhost","root","","da_name");
    }
?>
-----------------------------------------------------------------------
another method
<html>
<body>
<?php
// create connection
$con=mysqli_connect("localhost","root","");
//check error
if(mysqli_connect_errno())
{
    echo "Failed to connect to MySql".mysqli_connect_error();
}
?>
</body>
</html>



GitHub repository using Git Bash command

  To add a project to a GitHub repository using Git Bash command line, you can follow these steps: Create a new repository on GitHub by logg...