Sunday, 19 January 2014

php connection to sql server

Here i put the code php to sql server.this is connection string between php and sqlserver.
<?php
$myServer = "localhost";
$myUser = "your_name";
$myPass = "your_password";
$myDB = "examples"; 

//connection to the database
$dbha = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer"); 

//select a database to work with
$selected = mssql_select_db($myDB, $dbh)
or die("Couldn't open database $myDB"); 

//declare the SQL statement that will query the database
$query = "SELECT id, address, city ";
$query .= "FROM city ";
$query .= "WHERE id='001'"; 

//execute the SQL query and return records
$result = mssql_query($query);

$numRows = mssql_num_rows($result); 
echo "<h2>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>"; 

//display the results 
while($row = mssql_fetch_array($result))
{
echo "<li>" . $row["id"] . $row["address"] . $row["city"] . "</li>";
}
//close the connection
mssql_close($dbhandle);
?>

Thursday, 16 January 2014

Get Adsense Approved Fast - Maximum 2 Hours(2014 Tricks) | 100% Working Tricks

Google adsense is  advertising site. It paying good money for publishers. Here is easy trick to approve adsense in 2 hours and this trick is 100% working. you have the easy way of getting adsense approval using youtube






Just try the following step and get adsence.

Watch Youtube Video For More idea

Step 1: Create a new Gmail account and sign in to Youtube

Step 2: Upload  your own creation two or three Quality videos

Step 3: Video manager -> Channel settings->  Monetization

Step 4: Click on How will I be Paid? - >  accosiate an adsense account
Select your adsense account  which frist you have to created and send application.

Step 5: Adsense team will send  email to your gmail inbox.

Step 6: After( 2 hours )  sign in to your adsense account - >  Account settiings

Step 7: Access and Authorization --- >  Sites authorized to show ads ->  edit
Enter your blog url (eg: www.allcode4u.blogspot.in) then submit.

Step 8: After successfully creating adsense account put your add in your site or bloge.

This Trick 100% working.If any problem send me mail. you can easily earn 10% per a day.

Enjoy .. 





PHP: Create, Edit, Delete & View step by step (Part 1)



How to create grid view.
There are the following step for create grid view.

  1. Step 1:-
                  create one  your databese.


  • Step 2:-(conn1.php)
     
                The following code for connection with mysql database.
                <?php
                $username = "root";
                $password = "root";
                $hostname = "localhost";
                   //connection to the database
                     $conn = mysql_connect($hostname, $username)
                      or die("Unable to connect to MySQL");
                     $retval = mysql_query($conn);
                             ?>

  • Step 3:- (v.php)
               Fetch data from tha database in table formate.
                          <table class="table" width="2000">
 <thead>
 <tr>
   <th width="3">COMPANY </th>
 <th width="3">ADDRESS </th>
 <th width="10">MODE</th>
 <th width="30">City</th>                                     

                                                                         <th  width="35">OFFICE PERSON</th>  
     <th width="35">Start Date</th>
  <th width="35">End  Date</th>

 
 </tr>
 </thead>
<?PHP
                                                         include("conn1.php");
                                                     mysql_select_db('ravi');
                                                   $s1 = "SELECT * FROM r2";
    //echo $sql;exit;
    $result = mysql_query($s1);
    while($row=mysql_fetch_array($result))
    {
    ?>
<tr>
          <td><?php echo $row['name']; ?></td>
          <td><?php echo $row['add']; ?></td>
          <td><?php echo $row['mode']; ?></td>
 <td><?php echo $row['zip']; ?></td>
 <td><?php echo $row['cperson']; ?></td>
 <td><?php echo $row['date1'];?> </td>
<td><?php echo $row['date2'];?> </td>
<td><a class="span3 typeahead" href="edit.php?no=<?php echo $row['no']; ?>"> Edit/More </a></td>
      <td><a class="span3 typeahead" href="delete.php?no=<?php echo $row['no']; ?>">Delete</a></td>
</tr>
</table>
Step 4:-(edit.php)
<?php
include ('conn1.php');
mysql_select_db('ravi');
if (isset($_GET["no"]))
{
    $sn = (int)$_GET["no"];
} else
{
    // no student number given. redirect someplace? show an error message?
}?>

Then here put your html code and put table.
<?PHP
 
    //echo $sql;exit;
    $id = $sn;
 $s1 = "SELECT * FROM r2 where no=$sn";
 $result = mysql_query($s1);
    while($row=mysql_fetch_array($result))
    {
    ?>
<tr>
<th align="right">ID:-</th>
<th><input type="text" name="us1" value="<?php echo $row['no']; ?>" disabled="disabled">//display no coloum from database
</th>
</tr>



Monday, 6 January 2014

Beginner PHP Tutorial

PHP Tutorial Writing Your First PHP File How write and make webpage in to nthe php,In this tutorial we go over a short presentation on what PHP is, what is required to learn it and what we will be covering further down the line. This video will hopefully introduce you to the PHP scripting language and get you interested in learning more.

Beginner PHP Tutorial The phpinfo Function

 Beginner PHP Tutorial Writing Your First PHP File How write and make webpage in to nthe php,In this tutorial we go over a short presentation on what PHP is, what is required to learn it and what we will be covering further down the line. This video will hopefully introduce you to the PHP scripting language and get you interested in learning more.

Beginner PHP Tutorial Writing Your First PHP File

 Beginner PHP Tutorial Writing Your First PHP File How write and make webpage in to nthe php,In this tutorial we go over a short presentation on what PHP is, what is required to learn it and what we will be covering further down the line. This video will hopefully introduce you to the PHP scripting language and get you interested in learning more.

Thursday, 2 January 2014

php connect with sql

con.php
<?php 
$username = "root"; // user name
$password = "root"; // password
$hostname = "localhost"; //host name  
//connection to the database
$conn = mysql_connect($hostname, $username) 
  or die("Unable to connect to MySQL");
$retval = mysql_query($conn);

?>