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

Undefined index on my form
ok im getting Undefined index on this line.. print_r($_REQUEST['form']);

below is the full sc

Delete records not in top 15
Hi,

I'm creating a hall of fame page in my game and the page will only display the top 15 sco

Display Database
I need to create a shopping cart. I found this code online: http://conceptlogic.com/jcart/
Unfort

Basic Question about Threading and PHP...
I have a page that I am working on and it is taking several hours to process. The basics of what th

Unable to display contents in Second Drop Down Box
Hi All,

What I am trying to do is 2 dependent drop down boxes and when user selects su

LSB (PHP 5.3) problem with static value!
hello,

i'm having a problem. static::$text variable gets lost at some point. can someone plea

Need help with basic sql
Hi,

I am using oracle 10g, and having some small doubts related to sql , here goes the si

Send inserts to mysql thru port 80
Hi!

I have an application that must do some inserts in a mysql db. This db is behind a firewa

Secure pages Sessions vs. Cookies & session_destroy() help
Im new here and new to PHP, I hope you can help me with some questions.

Im writing my web ap

Giving the below syntax error
Dear Experts,

I have used 2 buttons in gui status as display and cjhange.When the user wi

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