simple script won't work. Please help


Posted on 16th Feb 2014 07:03 pm by admin

I'm new to php, and I am having trouble displaying a simple script in my web browser. My php code executes fine but the html tags in my script are treated as text and displayed on the page.

This is myscript:

Did you know?Explore Trending and Topic pages for more stories like this.
<?php

print “Opening the connection to the database server< br />”;

$link = mysql_connect("localhost", "root", "password");

print " Selecting a database< br />" ;

$result = mysql_select_db( "databasename" ) ;

if ( $result )

{

print " Database selected successfully< br />";

}

else

{

print " There was a problem with the database
selection< br />" ;

}

?>


This is the output:

Opening the connection to the database server< br /> Selecting a database< br /> Database selected successfully< br />

Why are the html tags being displayed in the output?

I'm using:

php 5.3.1
apache 2.2.12
mysql 5.0.88

on fedora 10.

Any help would be much appreciated.

Thanks
No comments posted yet

Your Answer:

Login to answer
346 Like 16 Dislike
Previous forums Next forums
Other forums

Regarding accessing SQL query issued by any user in Oracle 10g
Hi all,
i want to know the queries issued by various users accessing a database...

User feedback after MySQL query has been executed
Hi all, I've just registered on PHPFreaks because I've got a question that I simply can't work out b

Select all entries from database that include a phrase
I have a database of clubs - one of the categories is meeting time and place
I would like to have

Find occurences of unicode characters in string
I need to prohibit filenames with everything but English characters and numbers but regexp and strin

Changes to hosting company's server has affected web contact form
I started a thread a couple of months ago about the contact forms on my client's website. Basically

retrieving images from mysql database using php
So I've been trying to figure out how to store images in a mysql database, and as far as i can tell

Internal Server Error issues
This has been bothering me for weeks and I've been trying to solve it without asking for help, but e

comparing tables across databases sql refinement ideas required
Hi all

Via pl/sql I need to ensure that data between tables in different databases match

Results from Db outputted twice
Hey guys.. for come reason my data is outputted twise shown in the image below and i cant figure out

Progress bar tracking file downloads
Hey guys, was wondering if there was a way to track how far a file has been downloaded. I know there

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash