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

Code doesn't print what i wanted it too. Please help!
Hi there,

I wrote this code to mae it so that in the form before it that the user said their

Echo multiple lines of html code
Hi guys,

I would like to know if there is a way to echo multiple lines of html codes.

Script not running properly
Hello Everyone
This is a basic script for posting to a database. I'm not sure why it doesn't work

Simple Scraper... Weird Output
Okay, maybe I just need a Blue Monster and some sleep, but....

I'm scraping a ringtone site

batch file not building to webapps folder
Hello. I just started running Vista :P and can't seem to get my projects deployed. I found out how

$action = "insert"; //$action = $_GET['action'];
$action = "insert";
//$action = $_GET['action'];

why is this invalid type? I am

Logging and nologging bulk insert
Hi,

oracle version: 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

To change the name of label on SAP screen XK02.
Hi All,

Can one suggest me how to change the label of an input field of a sap standard s

Escaped characters
I have a script that allows you to post news to the home page of my site. Along with the news is the

Search function
I am looking for some guidance from the experts.

I am trying to create a search function. It

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