Saturday 12 April 2014

PHP CONNECTIVITY TO SQL

Hi Friedns for doing connectivity to sql database by php here is procedure by using XAMPP software


1) Install XAMPP software in to ur system
2) Save the php files in C:\XAMPP|htdocs folder
3)create database table in SQL
4)select default database test
5) run the file through browser by typing localhost/filname.php



use following code by doing connection
=======================================================================

Filename= 1.php

========================================================================
<?php

error_reporting(0);

$connect=mysql_connect("localhost","root","") or die("Not Connected");

echo"<br>Connecting..........";

mysql_selectdb("test") or die("No database found");

echo"<br>Connected to database";

?>
=========================================================================

Filename=2.php

=========================================================================
html><body>
<form action="2.php" method="post">
<h4>Name</h4><input type="text" name="nm" id="nm">
<h4>Id</h4><input type="text" name="op" id="op">

<select name="query" >
      <option value="1" >Select</option>
      <option value="2" >Update</option>
      <option value="3" >Delete</option>
      <option value="4" >Insert</option>
</select>

<input type="submit" value="Submit Query">


<?php

require("1.php");
$na=$_REQUEST['nm'];
$id1=$_POST['op'];
switch($_POST['query']){

case 1 :
$extract=mysql_query("select * from STUDENT");
 echo "<br>No. of rows in table :".mysql_num_rows($extract)."<table cellspacing='2' border='2'><th>ID</th><TH>Name</th>";
while($row=mysql_fetch_assoc($extract)){
   
    $id=$row['id'];

    $n=$row['name'];
    echo "<tr><td>".$id."</td><td>".$n."</td></tr>";

}
echo "</table>";break;

case 2 :
$update=mysql_query("UPDATE `test`.`STUDENT` SET `name` = '$na' WHERE `STUDENT`.`id` =$id1");
$extract=mysql_query("select * from STUDENT");
 echo "<br>No. of rows in table :".mysql_num_rows($extract)."<table cellspacing='2' border='2'><th>ID</th><TH>Name</th>";
while($row=mysql_fetch_assoc($extract)){
   
    $id=$row['id'];

    $n=$row['name'];
    echo "<tr><td>".$id."</td><td>".$n."</td></tr>";

}
echo "</table>";break;


case 3 :
$del=mysql_query("DELETE FROM `test`.`STUDENT` WHERE `STUDENT`.`id` =$id1");
$extract=mysql_query("select * from STUDENT");
 echo "<br>No. of rows in table :".mysql_num_rows($extract)."<table cellspacing='2' border='2'><th>ID</th><TH>Name</th>";
while($row=mysql_fetch_assoc($extract)){
   
    $id=$row['id'];

    $n=$row['name'];
    echo "<tr><td>".$id."</td><td>".$n."</td></tr>";

}
echo "</table>";break;

case 4 :
$write=mysql_query("Insert into STUDENT values('$id1','$na')");
$extract=mysql_query("select * from STUDENT");
 echo "<br>No. of rows in table :".mysql_num_rows($extract)."<table cellspacing='2' border='2'><th>ID</th><TH>Name</th>";
while($row=mysql_fetch_assoc($extract)){
   
    $id=$row['id'];

    $n=$row['name'];
    echo "<tr><td>".$id."</td><td>".$n."</td></tr>";

}
echo "</table>";break;

}
?>
</body>
</html>
====================================================================

Wednesday 9 October 2013

msg of the day 9-10-13

Posted: 08 Oct 2013 01:30 PM PDT
--------------------------------------
Soul Sustenance 09-10-2013
--------------------------------------

The Benefits Of Togetherness Over Isolation

Nowadays, there are more and more people who are choosing to live alone. Perhaps the reason for that are experiences in the past of pain, peacelessness, rejection, disappointment or failure when living together, in a relationship or even more than one relationship. As a result, the preference for living alone sets inside them. Perhaps, it is their alternative search for peace, happiness and success that leads them to make this decision. Also, the belief that if you live alone, you are free and you can do what you want, when you want and without having to explain yourself to anyone. But are we, as human beings, basically by nature, meant to live together or to live alone? Each human being has the need to belong and provide that feeling to others.You can belong to a family, a group of friends, a bunch of close school or college students, some office colleagues, a club, a community, a religious group etc. The mere presence of others; the participation, communication and collaboration with others; the assistance provided to others and received from them and the sharing of positive energy with others in a group; inspires and challenges us and others immensely. The same can happen, if we are staying alone, but to a limited extent.Greater inner spiritual empowerment takes place inside those who live and work together, not those who distance themselves from others. In a group, we broaden our limits and make our heart bigger when we do things for others that we wouldn't do for ourselves.

Each human being is a source of love for others. It is a basic human nature to love and be loved, which is not possible unless there is some kind of unity or mutual belonging. Distancing or isolating oneself implies an absence of love, neither given or shared, neither received.

-----------------------------------------
Message for the day 09-10-2013
-----------------------------------------

True courage brings benefit to the self as well as to others.

Projection: When there is fear, there is some kind of danger, either for the self or for others. The one who fears, or the one who doesn't have the courage to accept and face situations, is not able to bring out the best form within himself. Such a person is constantly thinking of excuses and is trying to blame others for the mistakes that happen.

Solution: With courage, if I am able to take up responsibility for every situation that I am faced with, I am able to be free from worry or tension. I will then be in a position to learn and so I find progress at every step in my life. I find others giving me a lot of good wishes for my sincerity. I also become an inspiration for all others too to bring about a positive change.


In Spiritual Service,
Brahma Kumaris