Hi
I have put following PHP code just below <body> and it is not connecting to database. You can also look at source code from page - http://tumblebus.x10hosting.com/
Could somebody please let me where i am wrong.
<body>
<?php
$dbhost = 'localhost';
$dbuser = 'deepji_admin';
$dbpass = 'homework';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'deepji_db';
mysql_select_db($dbname);
?>
Thanks
Deep
Beginner, My first PHP syntax in index.html is not working
Moderator: General Moderators
-
deep.singh
- Forum Newbie
- Posts: 2
- Joined: Fri Aug 15, 2008 11:41 pm
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Beginner, My first PHP syntax in index.html is not working
The file should be named index.php, not index.html.
(#10850)
Re: Beginner, My first PHP syntax in index.html is not working
Your page extension is not php, its htm or html, you need to change it to .php so the server knows you want to execute that php code in it, and not just show.
edit: soo late again
edit: soo late again
-
deep.singh
- Forum Newbie
- Posts: 2
- Joined: Fri Aug 15, 2008 11:41 pm
Re: Beginner, My first PHP syntax in index.html is not working
Thanks Guys, It worked.