Monday, 4 November 2024
Monday, 8 August 2016
Monday, 19 January 2015
Php database connection | how to connect with mysql in php | database connectivity in php
the below code do connectivity with the database with my sql
<?php
$servername = "localhost";
$username = "username";
$password = "password";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Create database
$sql = "CREATE DATABASE myDB";
if ($conn->query($sql) === TRUE) {
echo "Database created successfully";
} else {
echo "Error creating database: " . $conn->error;
}
$conn->close();
?>
The above written code if we write then connectivity will happen automatically , don't have to do any thing.mainly you need to follow some basic step in context of servername, databasename, username, user password
<?php
$servername = "localhost";
$username = "username";
$password = "password";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Create database
$sql = "CREATE DATABASE myDB";
if ($conn->query($sql) === TRUE) {
echo "Database created successfully";
} else {
echo "Error creating database: " . $conn->error;
}
$conn->close();
?>
The above written code if we write then connectivity will happen automatically , don't have to do any thing.mainly you need to follow some basic step in context of servername, databasename, username, user password
Friday, 12 December 2014
How to Integrate Your Blogger Blog with Website, integration of blog in the web site
Blogger is a place wherein you can write your opinion. Say
an example if we want to integrate blog
in the hosted web site to start our blog as it’s so easy to set up and start
blogging. Pretty soon though you might wish that your blog was integrated into
your main website. This simple how-to do , I have explained to show my opinion to achieve this.
Our motto is to integrate the
blogger blog in to main web site for a
couple of reasons:
- A consistent style including colors, brand, logo, name etc.
- Readers can find all your writing under one domain
- Readers feel like they are staying within the same site, whether they are reading regular site pages or blog posts
Here we’re going to look at a simple
way to add your blog to a sub domain of your existing site. So if your site is
called www.example.com, your blog would appear at blog.example.com (note that
this is just an example).
We’re assuming here that you’ve
already got an existing website and domain name set up.
There are 6 steps to take.
1. The first step is to make a
change to your DNS settings. These settings tell servers on the internet where
to find your website and here we’ll be telling them that they can find your
blog over at Google. Change your CNAME to point to the new address, which is
ghs.google.com – there are different ways to do this according to your website
host, so . If you
can’t find your host here, contact them directly and they will help you out
2. Now you’ll need to change your
publishing settings on Blogger. Open up your Blogger admin page and head over
to Settings:
3. Click on ‘custom doman’:
4. You’ll see a message pop up
saying ‘buy a domain for your blog’ – you don’t want this so click on ‘switch
to advanced settings’
5. You’re now on advanced settings –
go ahead and fill out your domain name (that’s blog.example.com – remember?):
6. Click save and you’re done!
It may take a day or two for the new
settings to take effect. If it doesn’t work right away, wait a while before
checking your settings or contacting your host.
When it’s all set up and working,
you’ll be able to head over to blog.example.com and see your blog! Depending on
the blog theme you’ve chosen, you might now want to start tweaking and
customizing your blog so it fits in with the style of your existing website.
This is a wise move since it helps to give a consistent look to both your blog
and your main site.
Sunday, 14 July 2013
what is purpose of inheritance
the basic purpose of inheritance is to extend the capability of an entity by inheriting from an existing entity It works the same way as in the real world scenario; children inherit the features from their parents
Saturday, 13 July 2013
difference between classes and object
In the simplest terms in int i, int is class and i is an object of that class. From the int class we can create several objects(variables). The int class indicates what kind of data an object of its type can hold and what operations(adition, subtration, etc) can be performed on this data . Aclass is thus a description of number of similar objects. it specifies what data and what functions will be included in objects of that class.
Instead of standard class like int you can think of user defined class like employee from which object like , e1, e2, e3 can be created through a statement .
employee e1, e2, e3;
Instead of standard class like int you can think of user defined class like employee from which object like , e1, e2, e3 can be created through a statement .
employee e1, e2, e3;
difference betwen classes and objects in layman's lterms
A class is a blueprint for objects. From one class several objects can be created Each object is known as an instance of a particular class. for example, 'cricketers' is a class, wheres, 'player name' is specific instance of the cricketers class describes (hence they are objects).The blueprint for Cricketers class describes how a cricketer would look like(coloured/white clothing, cap etc)and what operations can he perform(bat, bowl, field, etc)similarly, you can imagine 'Musicians' as a class and 'Lata' and 'Asha' as specific instances of this class. Again from one class of musicians several instances(objects) can be created.
