I'm trying to connect and can. The code fails at the select database. I have created the Tools database already. The table is an exact clone of the mysql counterpart that is currently working. Any Suggestions?

<?php

$dbuser="yukon";
$dbpass="yukon";
$dbname="Tools";  //the name of the database
$chandle = odbc_connect("sqlserver", $dbuser, $dbpass)
    or die("Connection Failure to Database");
echo "Connected to database server<br>";

//select a database to work with
$selected = mssql_select_db($dbname, $chandle)
  or die("Couldn't open database $myDB");

?>

Recommended Answers

All 2 Replies

Try this

<?php
$Server = "localhost";
$User = "yukon";
$Pass = "yukon";
$DB = "Tools";

//connection to the database
$dbhandle = mssql_connect($Server, $User, $Pass)
  or die("Couldn't connect to SQL Server on $Server");

//select a database to work with
$selected = mssql_select_db($DB, $dbhandle)
  or die("Couldn't open database $DB"); 

?>

I did manage to get it, now i'm just figuring out how to convert the array to work with mssql.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.