Thursday, 31 July 2014

Hello Friends...!!!


As every Friday, here is the answer sheet of yesterday's test...


Match your answers and tell us your reault..


interview Questions for PHP and mysql, web development

 


For questions CLICK HERE :  Quiz to improve WEB DEVELOPMENT skills


Answers :


Question no.                          Answer

    Que. 1                                      C
    Que. 2                                      D
    Que. 3                                      A
    Que. 4                                      D
    Que. 5                                      A
    Que. 6                                      D
    Que. 7                                      C
    Que. 8                                      B
    Que. 9                                      C
    Que. 10                                    B


Want more Questions CLICK THE LINKS BELOW


 PHP Multiple choice questions and answers-1
  PHP Multiple choice questions and answers-2
  PHP Multiple choice questions and answers-3
  PHP Multiple choice questions-4

 


Share your experience with us... or give any suggestion in comments.

 

Regards : M2 Software Solutions Pvt. Ltd.

Wednesday, 30 July 2014

Hello Everyone...!!!

 

Every Thursday we conduct a quiz practice for PHP DEVELOPER which help them to improve their WEB DEVELOPMENT skills

 

Today i am Here are some mySQL (Database) questions to solve...

 

 
interview questions for PHP developers, PHP web development test, PHP quiz questions
PHP interview questions

 

Que.1 The updated MySQL extension released with PHP 5 is typically referred to as..


a) MySQL
b) mysql
c) mysqli
d) mysqly 


Que. 2 mysql_connect( ) does not take following parameter


a) Database host 
b) User ID
c) Password
d) Database name


Que. 3 Which one of the following statements instantiates the mysqli class?

a) mysqli = new mysqli()
b) $mysqli = new mysqli()
c) $mysqli->new.mysqli()
d) mysqli->new.mysqli()

Que. 4 Which of the following is not a session function?


a) sssion_decode
b) session_destroy
c) sessipon_id
d) session_PW


Que. 5 Which one of the following methods is responsible for sending the query to the database?


a) query()
b) send_query()
c) sendquery()
d) query_send()


Que.6  Which one of the following methods recuperates any memory consumed by a result set?


a) destroy()
b) remover()
c) alloc()
d) free()


Que.7  If there is no error, then what will the error() method return?


a) TRUE
b) FALSE
c) Empty String
d) 0


Que. 8 Which version of MySQL introduced the prepared statements?


a) MySQL 4.0
b) MySQL 4.1
c) MySQL 4.2
d) MySQL 4.3


Que.9  Which method retrieves each row from the prepared statement result and assigns the fields to the bound results?


a) get_row()
b) fetch_row()
c) fetch()
d) row()


Que. 10 Which one of the following statements should be used to include a file?


a) #include ‘filename’;
b) include ‘filename’;
c) @include ‘filename’;
d) #include 


Answersheet of this quiz will be available tomorrow ..


Want more Questions CLICK THE LINKS BELOW


 PHP Multiple choice questions and answers-1
  PHP Multiple choice questions and answers-2
  PHP Multiple choice questions and answers-3
  PHP Multiple choice questions-4
 



Share your experience or if you have any suggestion feel free to give in comments


Regards : M2 Software Solutions Pvt. Ltd. 




Hello Friends ...!!!

Today i have seen a lot of mails in my inbox..

There was a complaint that i am taking a test of WEB DEVELOPMENT ( PHP test) on each Thursday and not taking a test of WEB DESIGN..

web designer, web design,



So on a huge demand here is a test of WEB DESIGN .. for WEB DESIGNER..


Questions


Que.1 What is Web Tracking


A The unauthorized use or close imitation of the language and thoughts of another author and the representation of them as one's own original work.

B. Is the analysis of visitor behavior on a website 

C. A simple electronic connector consisting of a thin, stiff, bare wire intended to fit into a corresponding socket. 

D. Is a single character 

Que. 2 What is Cookie?


A. A data file written to a hard drive by some Web sites, contains information the site can use to track such things as passwords, login, registration or identification, user preferences, online shopping cart information, and lists of pages visited. 

B. Not losing information when power is interrupted. 

C. Coding used for internet language. 

D. Is the fastest type of computer 

Que.3 What is a crop tool

 

A. Cuts out background noise and highlights the image area you want to keep. 

B. Allows people to interact with a computer and computer-controlled devices.  

C. The software application that allows you to view Internet pages.  

D. Is text, numbers, sound, images, or video.  

Que. 4 What is Canvas


A. The computer receives data through an input device, processes the data, stores the data on a storage device, and produces output  

B. Is a unit of measurement of information storage.  

C. The area designated to your image.

D. A window you can open to adjust various aspects of your computer, such as the volume, fonts, desktop background, mouse speed, and clock.  

Que. 5  What are Constrain Proportions 


A. A key used to access commands through the keyboard rather than the menus.

B. Allows your image to contract or contain proportionately.  

C. Used in various online communications, such as e-mail messages or postings to newsgroups or BBSs. It is a communication that finishes the message.  

D. (Also called laptop computers) are small personal computers that contain the monitor with a built-in keyboard.  

Que. 6. What are Filters?


A. The unique address name for an Internet site.

B. To save a file onto your computer from another source, like the Internet.  
   
C. Allows you to manipulate an image or words to change the appearance.  

D. A common method of networking computers in a Local Area Network (LAN)  

Que.7 What is sharpen 


A. Increases the look of your photo with crispness. 

B. A computer network limited to the immediate area, usually the same building. 
 
C. Generally is used by small to medium-size companies and can support a few users or hundreds of users. Most are referred to as network servers or application servers. 

D. A software program that performs repetitive functions, such as indexing information on the Internet. 

Que.8 What is unsharp mask ?


A.  A Protocol that allows users to copy files between their local system and any system they can reach on the network  

B. An integrated collection of security measures designed to prevent unauthorized electronic access to a networked computer system.
  
C. Generally can fit into the palm of your hand.

D. Improve the clarity of scanned images without increasing resolution  

Que.9 What are Dimentions?

 

A. A measurement of how fast data is transmitted. It is usually used to describe modem speeds or the speed of a digital connection.  

B. Is a personal computer similar in size and thickness to a notepad.

C. Determines the size of your image  

D. A device for storing information in a fixed location within your computer.  

Que. 10 What is  Brightness/contrass?


A. Are aspects of color in the red, green, and blue (RGB) scheme. These terms are most often used in reference to the color of each pixel in a cathode ray tube (cathode ray tube) display.

B. The page on the Internet, which most often gives users access to the rest of the Web site. A site is a collection of pages.  

C. The name given to any computer directly connected to the Internet. Host computers are usually associated with running computer networks, online services, or bulletin  

D. A

Want to learn more CLICK HERE

E-commerce website design principles
User-Friendly web design tips
Mistakes done in web designing
10 Best website templates
Free web design softwares for web design

Mistakes in responsive web design

Single page web design

 

Solve the questions and share your experience with us in comments 


Regards : M2 Software Solutions Pvt. Ltd.

Monday, 28 July 2014

Hello Friends...!!!

As you know WEB DESIGNING is a creative field.. we can not stuck to one

We have to invent new ideas.. everyday

Now a days single page websites are very popular..

So there are some tips from M2 Software Solutions to create beautiful WEB DESIGN

single page web design,m2soft, responsive web design


1. Fixed Block Scrolling :


When you fit all website content is onto a single page you can break down each section into horizontal blocks. As the user scrolls vertically they pass by each section denoted through background colors, images, or even horizontal rule breaks. This idea can be expanded with forced scrolling sections.

2. Responsive Web Design :


Coupled with the importance of mobile support includes naturally responsive layouts. RWD isn’t a new concept, but the implementation is still in a growth & research phase. Designers are constantly playing around with new ideas for responsive web design. Portfolios are even more important because they represent your work quality and even some tidbits about yourself.

3. Animations & Effects


A bit of charm in your single page portfolio will capture more attention if done correctly. There is a limit where visitors will not put up with your outrageous animations – but a neat balance will give the effect of dynamic and creative design talents.

4.Hidden Sliding Navigation :


The topic of navigation seems a bit confusing on a single page website. Since a one page portfolio has no inner pages(or very few), the nav links create auto-scrolling behavior. So basically users will click a link and it scrolls down to that section of the page.

5. Clean Minimalism :


The simplest technique for creating a usable single page portfolio is clarity and minimalism. That doesn’t mean you should only stick to white colors and contrasting text. Instead just try to strip down the layout into absolute necessities. Once you’ve got a wireframe or mockup design then go back to add extra fancy icons or text effects.

Share your thoughts or if you have any suggestions with us in comments  ..

 

you may also like :

 

E-commerce website design principles
User-Friendly web design tips
Mistakes done in web designing
10 Best website templates
Free web design softwares for web design

  

Regards : M2Software Solutions Pvt. Ltd.





Hello Friends...

 

There are some mistakes done by web designers while making responsive website design...


They are :




REAPONSIVE WEB DESIEGN,WEB DESIGNER






1. Hiding Content


Often, designers hide or discard website content in order to make it fit to a smaller device or screen-size. There are still many responsive sites that hide or remove content for smaller screens in order to deal with screen real estate constraints. If you hide content only for the sake of adjusting the size to a smaller screen, you’ll deprive them of that experience. To acquire content parity, you’ll need to change the content of a responsive site so that it can be viewed by all.

2. Making compromises on the design


If you will make compromises on the design the design will not be as good as you can create. web design is always ab creative and exiting challenge for web designers. There is no limitation for design. remember don't make any compromise while designing a website.

3. Forgetting about touch :


Remember that anything that's click-able and viewed on a smart-phone needs to be the size of a thumb. It's why we have thumbs, isn't it? Apple themselves recommend the minimum acceptable size for mobile controls to be 44 pixels. And don't put links too close together, or big-thumbed users will never forgive you.

4. Forgetting to create a home screen icon


Remember that anything that's clickable and viewed on a smartphone needs to be the size of a thumb. It's why we have thumbs, isn't it? Apple themselves recommend the minimum acceptable size for mobile controls to be 44 pixels. And don't put links too close together, or big-thumbed users will never forgive you.

5. Disabling the magnification


Disabling the zoom facility, and taking control out of your users hands is bad form indeed. Don't make your users think you hate them.

Use code to Disable the magnification :
<meta name="viewport" content="width=device-width initial-scale=1, maximum-scale=1, user-scalable=no">

you may like : 

E-commerce website design principles
User-Friendly web design tips
Mistakes done in web designing
10 Best website templates
Free web design softwares for web design


Share your experience or give any suggestion in comments


Regards : M2 Software Solutions Pvt. Ltd.



Friday, 25 July 2014

Hello Everyone..

We all know many of the people need website.. according to need.. like business,education, etc.

But actually they don't know what should they ask to  WEB DEVELOPMENT COMPANIES before hiring .. 

web development companies, M2Soft Solutions,website design, questions for web development



As you know M2Soft Solutions is a web development company..and we know the questions asked by our clients

Here are the questions :


Que.1 know company's details : to get the company detail is the first step to approach 


That includes
A) Who owns the company?
B) How big is the company?
C) What is their structure?
D) Financially stable?

Que. 2  Can you provide examples of websites that your company designed?


By looking at the projects created by company, you can get an idea of responsiveness of their designs,company can fullfill your desires or not, they have complete large scale projects or not.

Que. 3  Who will be working on my website and What are the qualifications of those working on my project? 


To know who is working on your project and what are their qualifications is an important to know. Because you need the services and you should know that do they  attend conferences, workshops, seminars, etc.  and does the firm provide for the continuing education of the staff? Do they hold certifications in the relevant areas of expertise? or not.

Que. 4   What happens if I don’t like the initial design and How long will it take to complete my website?


Make it clear that until i am not satisfied with the website design they will not develop the website. and after the web design is decided make an dead line for the project that is how much time will it take to be completed. 

Que.5 Will my website be compatible with Smartphones, tablets and other mobile devices?

 

If you are having a business whose sell is on the mobile devices like iphone ,
android, and windows tablets also. make it clear with the company that it will run on such devices or not.

Que. 6 Do you build search engine optimization friendly websites?

 

Everyone wants that his website should be SEO friendly so that it will be ay the top of search engine and provide them more profit. 

Que. 7 What type of content management system do you use?


There are many Content management system (CMS) available like WordPress, Druple, Magento,etc. ask the company on which CMS they will built the website.

Que. 6 How do you price your services and What is included in the price? 


Ask about the pricing policy of the company and make it clear that which are the services they are providing. before giving the contract make all the things clear.

Que.7 Will the functionality of my website be tested before it goes live?


Before going online website must be tested. because if it has some problem then it can harm the brand image of the website owner or can provide problem to the owner.

Que. 8. Do you offer on-going maintenance after my site goes live?


Ask them that will they maintain the website after it goes online or not. many of the companies does not provide this service to the owner.

These are the Must ask questions before hiring ant web development company.

 

Know more about Web Development Companies :

5 Top Companies


Share your experience with us or give any suggestions in comments

Regards : M2 Software Solutions Pvt. Ltd.







Wednesday, 23 July 2014

Hello everyone..!!!

Today is Thursday, on every Thursday i come here with a PHP test for PHP developers..

They are the questions asked by WEB DEVELOPMENT COMPANIES in interview.. to PHP DEVELOPER


web development companies, PHP developer,PHP questions



PHP QUESTIONS :
 

Que. 1 Which of those is not magic method?


A. __autoload
B. __clone
C. __sleep
D. __toint

Que.2 What function creates a cookie?  


A. create_cookie()
B. set_cookie()
C. setcookie()
D.None of the above

Que. 3  Which of the folowing are valid float values?


A. 4.5678
B. 4.0
C. 7e4
d. All of the above

Que. 4 PHP is an open source software


A. True
B. False

Que. 5 How does the identity operator === compare two values?


A) It converts them to a common compatible data type and then compares the resulting values
B) It returns True only if they are both of the same type and value
C) If the two values are strings, it performs a lexical comparison
D) It bases its comparison on the C strcmp function exclusively
E) It converts both values to strings and compares them


Que. 6 Which keyword cannot be used while defining property?

 
A. Public
B. Static
C.Final
D.Private

Que. 7 Which PHP function or variable will return the value of current session id? 


A. session_id()
B. get_session_id;
C. $_SESSION['CURRENT_ID'];
D. $_SESSION['ID']

Que. 8 In PHP 5, how can you write a class so that some of its properties cannot be accessed from outside its methods? 

 

A. By declaring the class as private
B. By declaring the property as private
C. It cannot be done
D. By writing a property overloading method

 

Que. 9  Identify the invalid identifier



A. my-function
B. size
C. -some word
D. this&that

Que. 10 Under what circumstance is it impossible to assign a default value to a parameter while declaring a function?


A. When the parameter is Boolean
B. When the function is being declared as a member of a class
C. When the parameter is being declared as passed by reference
D. When the function contains only one parameter
E. Never

MORE PHP INTERVIEW QUESTIONS

PHP Multiple choice questions and answers-1
PHP Multiple choice questions and answers-2
PHP Multiple choice questions and answers-3
PHP Multiple choice questions-4



Please share your Experience or give any suggestions in comments...


Regards : M2 Software Solutions Pvt. Ltd.



Tuesday, 22 July 2014

Hello Friends...!!!

In  recent days i have found a question in my mail box many times ...that is

Where can i find Top Web development companies list 2014?

web development companies

 


So i decided to create a list of Web Development Companies for 2014. i have analyze all the companies on the basis of revenue,full time employs,active clients, clients retention rate and pricing.

Here is the list..


1. BigDrop


Located at                     New york
Founded                         2003
Revenue                         $1 million - $2,999,999 
Full time employees      26-50
Active clients                 100 above
Client retention rate      98 %
Pricing                           Medium

2. Buildrr LLC :


Located at                    New york
Founded                        2003
Revenue                        $250,000 - $999,000
Full time employees     1-10
Active clients                 37
Client retention rate     97 %
Pricing                          Medium

3. Net@work :

 

Located at                     New york
Founded                        1996
Revenue                        Over $5 million
Full time employees      100 above
Active clients                 5000
Client retention rate     95 %
Pricing                          Medium

4. HUEMOR :


Located at                    New york
Founded                       2011
Revenue                       $250,000 - $999,000
Full time employees    11-25
Active clients               11-25
Client retention rate    98 %
Pricing                         Medium

 

5. Netmark.com


Located at                    Idaho
Founded                        2007
Revenue                       Over $5 million
Full time employees     26-50
Active clients                300 above
Client retention rate    96 %
Pricing                          Medium

What do you think.. Which is better from them..


share your experience with us.. via comment


Regards : M2Software Solutions Pvt. Ltd.

 





Hello Everyone...
We have Openings in our company.


Job Description

We are in the process of hiring potential candidates at  M2Software Solutions Pvt. Ltd. for Indore location for the position of Senior PHP Developer.

 Role                 : PHP developer (Core PHP and WordPress)


 Preference       : candidate having experience in Web-Development of
                               Financial and Advisory firm will be prefered.

NO. of vacancy :   2

Location            : Indore

Experience       : 1 yr - 2 yrs

Salary               : No bar for deserving candidate

Contact           : Miss Ekta
Contact no.     : 0731-6525051
E-mail              :  hr@m2soft.co.in 

                            OR

Apply Here      : http://m2soft.co.in/careers.php

Address           :   325, 3rd Floor Orbit Mall
                             A B, Road Indore(M.P.)

Visit our website for company profile : m2soft solutions Pvt. Ltd

Regards : M2 Software solutions Pvt. Ltd.





Monday, 21 July 2014

Hello Friends ..

How Are you ..I hope you all are fine

Today i am here with a important topic about web development ..

web development, web developer,


As you know web development is a very important part of IT industry. Being a good developer means staying on your toes and always learning, because there are so many important skills and these are constantly changing.


Things web developer should know


1. Java script Library :

A web developer should know a good java script language that makes development much easier it can be jquery, mootools or learning a java script library. learning a java script library saves your time during development. you can easily use the code of several things from library.

2.  Cross-browser debugging : 


Your website should run in any major browser like (IE6, IE7, IE8, FF2, FF3, Safari 4, Opera 9) to reach as many viewers as possible. I know  Everyone hates cross-browser debugging, but the better you get the less you’ll have to do it.

3. Basic SEO : 


you should know the basic concepts of search engine optimisation (SEO) to develop your website SEO friendly. This means clean markup and good use of <title>, <meta>, <h1> and <h2> tags on the front-end, as well as solid link and directory structure organisation on the back-end. 

4. cyber law basics : 


you are not doing law, but it is better for all developers to know at least basic knowledge of copyright and cyber law. Since websites are essentially publications, copyright issues tend to be the most common legal issue for sites.


5. Debugging software : 


a good debugger helps to make your programming much quicker. At front-end i personally like firebug. which allows you to click elements on the page and analyse which styles are being applied and from which style-sheet. You can additionally add or remove styles on the fly, as well as edit the page markup. 

          Firebug also helps with JavaScript debugging, providing a better analysis of JavaScript errors, as well as a console for runningJavaScript on the fly and displaying output from console.log(). Finally it provides NET info, showing you the loading time of various front-end assets as well as anything that is 404′ing or otherwise not loading.

There are more things that should a web developer know... if you know please share with us via comment...

 

Regards : M2 Software Solutions Pvt. Ltd.







Sunday, 20 July 2014

Hello everyone..

 

There is a problem with this PHP code... 

 

PHP developers find it out..



 
<?php
$badinput=false;

function check($arg1,$arg2)
{
    if(($arg1<0)||($arg1>100))
    {
    $badinput=true;
    }

    if(strlen($arg2)>32)
    {
    $badinput=true;
    }
}

$val=499;
$name="Unexpected results or non-execution ";

check($val,$name);

if(!$badinput)
    echo "Good";
else 
    echo "Bad input";
?>
 

waiting for solution...


Please leave a reply..

 

Regards : M2 Software solutions Pvt. Ltd.


 

Friday, 18 July 2014

True and Intresting facts about web and Technolgy

Posted by Unknown | 23:19 Categories: ,
Hello friends....


Today i am here with some true and interesting facts about WEB and TECHNOLOGY... 

 

web,technology

 

Have a look at this...

1. Email and Spam facts :


  • Do you know 60 billions emails are sent everyday in which 97% of are Spam.

  • Out of every 1,000 computers, 9 computers are infected with Spam.

  1. Spammer get only 1 response to every 12 million emails he send (yet it still makes them a small profit).

2. About Social Media : 

 

  • There is a twitterer called  “twillionaire” with a million or more followers.

  • Facebook has 500 million registered users… and still about 100 million less than  QQ (a Chinese social media portal)

  • There are About 20% of the videos on YouTube are music related.


  • Every minute 24 hours of video viewing is uploaded on YouTube.

  • Flickr hosts some 5 billion photographs, Facebook hosts more than 15 billion.

3. Gadgets & Technology:

 

  • The first public cell phone call was made by Martin Cooper on April 3, 1973.

  • The first cell phone sold in US called Motorola DynaTAC 8000X, launched on April 11, 1984, it was designed by Rudy Krolopp and weighed 2 pounds.


  • There are more than 4 billion cell phones in use. About 3 million cell phones are sold every day.


  • In 2004 the first known cell phone virus, Cabir.A appeared .

4. Search Engines, Internet and Energy:

 

  • Amazon now sells more e-books than printed books.


  • About 1.8 billion people connect to the Internet, only 450 million of them speak English.


  • Google handles about 1 billion search queries per day, releasing some 200 tons of CO2 per day.
  • Google uses an estimated 15 billion kWh of electricity per year, more than most countries. However, google generates a lot of their own power with their solar panels.

5. Information Technology:

 

  • In 1981, IBM started the PC revolution with the introduction of the IBM 5150, a compact personal computer that smoked mainframe processing and came at a price tag of under $1,600.  


  • IBM invests $6 billion a year on research. 

  • Microsoft was originally named Micro-Soft. They dropped the dash in 1976. 


  • Microsoft total revenue in its 1st year: $16,000

Do you found that facts interesting.. if you.. then share your experience with us..

 




Thursday, 17 July 2014

Hello friends...


Today i am here with some very useful PHP code snippets for PHP developer... have a look at this..

 
PHP code, PHP web development


1. Send Mail using mail function inEmail validation snippet in PHP.




$to = "viralpatel.net@gmail.com";
$subject = "VIRALPATEL.net";
$body = "Body of your message here you can use HTML too. e.g. <br> <b> Bold </b>";
$headers = "From: Peter\r\n";
$headers .= "Reply-To: info@yoursite.com\r\n";
$headers .= "Return-Path: info@yoursite.com\r\n";
$headers .= "X-Mailer: PHP5\n";
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to,$subject,$body,$headers);
?> 

2. Email validation snippet in PHP


$email = $_POST['email'];
if(preg_match("~([a-zA-Z0-9!#$%&amp;'*+-/=?^_`{|}~])@([a-zA-Z0-9-]).([a-zA-Z0-9]{2,4})~",$email)) {
    echo 'This is a valid email.';
} else{
    echo 'This is an invalid email.';

3. Parsing XML in easy way using PHP.

 

//this is a sample xml string
$xml_string="<?xml version='1.0'?>
<moleculedb>
    <molecule name='Benzine'>
        <symbol>ben</symbol>
        <code>A</code>
    </molecule>
    <molecule name='Water'>
        <symbol>h2o</symbol>
        <code>K</code>
    </molecule>
</moleculedb>";
//load the xml string using simplexml function
$xml = simplexml_load_string($xml_string);
//loop through the each node of molecule
foreach ($xml->molecule as $record)
{
   //attribute are accessted by
   echo $record['name'], '  ';
   //node are accessted by -> operator
   echo $record->symbol, '  ';
   echo $record->code, '<br />';
}

4. Generate An Authentication Code in PHP


<?php
# This particular code will generate a random string
# that is 25 charicters long 25 comes from the number
# that is in the for loop
$string = "abcdefghijklmnopqrstuvwxyz0123456789";
for($i=0;$i<25;$i++){
    $pos = rand(0,36);
    $str .= $string{$pos};
}
echo $str;
# If you have a database you can save the string in
# there, and send the user an email with the code in
# it they then can click a link or copy the code
# and you can then verify that that is the correct email
# or verify what ever you want to verify
?>

5. HTTP Redirection in PHP


<?php
    header('Location: http://you_stuff/url.php'); // stick your url here
?>

 

6. Creating and Parsing JSON data in PHP

Following is the PHP code to create the JSON data format of above example using array of PHP.
$json_data = array ('id'=>1,'name'=>"rolf",'country'=>'russia',"office"=>array("google","oracle"));
echo json_encode($json_data);
Following code will parse the JSON data into PHP arrays.
 $json_string='{"id":1,"name":"rolf","country":"russia","office":["google","oracle"]} ';
$obj=json_decode($json_string);
//print the parsed data
echo $obj->name; //displays rolf
echo $obj->office[0]; //displays google

 7. Database Connection in PHP

 

<?php
if(basename(__FILE__) == basename($_SERVER['PHP_SELF'])) send_404();
$dbHost = "localhost";        //Location Of Database usually its localhost
$dbUser = "xxxx";            //Database User Name
$dbPass = "xxxx";            //Database Password
$dbDatabase = "xxxx";       //Database Name
$db = mysql_connect("$dbHost", "$dbUser", "$dbPass") or die ("Error connecting to database.");
mysql_select_db("$dbDatabase", $db) or die ("Couldn't select the database.");
# This function will send an imitation 404 page if the user
# types in this files filename into the address bar.
# only files connecting with in the same directory as this
# file will be able to use it as well.
function send_404()
{
    header('HTTP/1.x 404 Not Found');
    print '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">'."n".
    '<html><head>'."n".
    '<title>404 Not Found</title>'."n".
    '</head><body>'."n".
    '<h1>Not Found</h1>'."n".
    '<p>The requested URL '.
    str_replace(strstr($_SERVER['REQUEST_URI'], '?'), '', $_SERVER['REQUEST_URI']).
    ' was not found on this server.</p>'."n".
    '</body></html>'."n";
    exit;
}
# In any file you want to connect to the database,
# and in this case we will name this file db.php
# just add this line of php code (without the pound sign):
# include"db.php";
?>

Share your experience with us via comment...


Regards : M2 Software Solutions Pvt. Ltd.


  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube