Board index   FAQ   Search  
Register  Login
Board index php forum :: php and mysql Web Hosting Hosting - Shared and Dedicated server Solutions

PHP & MS SQL

Where may I host my php/mysql web site ?

Moderators: macek, egami, gesf

PHP & MS SQL

Postby hmpjoy » Mon Aug 08, 2011 11:50 am

Hi, I am trying to access the SQL Server 2005 with PHP. For that I have activated IIS 7 on the windows small business server, for PHP. Now I have the following code for local web hosting :

=====================================

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="refresh" content="2";url="index.php";>
<title>Trial 1</title>

</head>
<h1>
:: B List ::
</h1>


<?php

$now = time();
echo $now;

$link = mssql_connect("SRVR name", "local host \ user name", "password");

if (!$link)
{
die('ERROR: Could not connect');
}


mssql_select_db('database name', $link);


$query = mssql_query('SELECT B_No, FROM dbo.B_LIST WHERE B_No = 000011', $link);

if (!$query)
{
die('MSSQL error');
}

$row = mssql_fetch_row ($query);


echo $row;


?>


<body>
</body>
</html>
=========================================

In this I am just trying to print one row from the database on the webpage
Correct me if I am wrong, as I am coding PHP for the first time with online help.

When I try to access the webpage on the explorer I only get the title and the page if refreshed every 2 seconds , and the time is displayed. Nothing is available from database.

Thank you.
hmpjoy
New php-forum User
New php-forum User
 
Posts: 1
Joined: Mon Aug 08, 2011 11:25 am

Re: PHP & MS SQL

Postby egami » Tue Aug 09, 2011 4:20 am

Check your log file for errors. If you didn't compile MsSQL into PHP, then it won't work.
User avatar
egami
php-forum GURU
php-forum GURU
 
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT


Return to Hosting - Shared and Dedicated server Solutions

Who is online

Users browsing this forum: No registered users and 0 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron