Page 1 of 1
I GOT TROUBLE WITH MSSQL !!!
Posted: Thu Nov 11, 2004 4:23 pm
by farid
Hi, I hope that someone can help me to execute a query to obtain some information from a stored in a Microsoft SQL server from a different server.
Thanks!![/list]
Posted: Thu Nov 11, 2004 4:25 pm
by John Cartwright
instead of connecting with LOCALHOST use the servers IP addresss. You must also make sure the mysql db is configured to allow from the outside wordl :p
Posted: Thu Nov 11, 2004 4:25 pm
by rehfeld
post your code
Posted: Thu Nov 11, 2004 4:26 pm
by farid
Here“s my code:
<?php
$myServer = "192.168.88.4";
$myUser = "estracom";
$myPass = "comerciales";
$myDB = "smsdb";
$conn = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer");
if ($conn) {
mssql_select_db($myDB, $conn) or die("Couldn't open database $myDB");
$stmt=mssql_init("sp_fichasEstrategiasCom",$conn);
$result=mssql_execute($stmt);
$arr=mssql_fetch_row($result);
print ("Answer: " . $arr[0] . "<br>" );
mssql_close($conn);
}
else print("No connection");
?>
And nothing happens!!
=(
Posted: Thu Nov 11, 2004 4:49 pm
by neophyte
Dump $arr out and see if it is populated. If it isn't than you probably have something wrong with your query. Within the if $conn statement try this:
Code: Select all
<?php
print_r($arr); //or var_dump($arr);
?>