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:

<?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

sendmail code suddenly not working
Hi Guys, I maintain 3 sites (including my own) I use the following code from a french webmaster that

MFC GUI Programming
I am working on a project right now that requires me to create a MFC Windows GUI. Basically it need

How to refresh a parent page from a modal popup
Hi,I have a modal popup in which I need to upload a file and store in the database should give a mes

PHP Thumbnail Creation
Ok so i use this function to create thumbnails:

Code: [Select]function createthumb($name,$fil

Gaining access to Drop Down Menu Variable
code is below, I am creating a drop down menu. I want to echo the value selected in the drop down me

Final year project, please point me in the right direction
hi there for my final year project I'm aiming to build a php script shell to use as an expert system

Request.UrlReferrer
I need to make it so that a page can only be loaded when a button is clicked on a specific page. I d

PHP and Javascript
Hi Guys,

Im trying to load the contents of an html file into a text area for editing, this is

How to show next and prev records
Hi all,

Sorry if this is simple, i'm very new to php, well, any programming language actually

a function to check directory depth
I'm working on a php script to upload files in to a set directory.
the user can select to upload

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