Page 1 of 1

Probably simple PHP & MSSQL query problem

Posted: Thu Sep 15, 2005 3:59 pm
by xyligosw
Hi all, im a bit of a noob at PHP used to do a lot of ASP. I was wondering if anyone could help solve a problem thats plaugeing me:

Code: Select all

$conn = mssql_connect("myhost.com","xyligosw","*****") or die("ERROR: Could not connect to DB!");
		mssql_select_db("xyligo_com",$conn) or die("ERROR: Could Not select Tables!");
		$sql = "SELECT * FROM news";
		echo $conn;
		echo "<br>";
		echo $sql;
$t    = mssql_query($sql,$conn) or die("<br>ERROR");
This executes and leaves me with "ERROR" printed mindlessly without any explanation. I know there is a (or die(mysql_error())) but i can't seem to find one for mssql to give me an accurate idea of whats gone wrong.

All help in this matter is greatly appreciated!!

Thanks

Dan

PS i've removed the hostname and password, these have been checked multiple times and work when used to execute other queries. This seems to be the only one that crashes!

Posted: Thu Sep 15, 2005 4:43 pm
by jayshields
this is a long shot, but try putting an @ before mssql_query. i think it would stop the script from stopping or something. i can only remember its exact use vaguely but its definately worth a try. also, give mssql_error a try, might work (would be easier to just check http://www.php.net...)

HTH somehow.

Posted: Thu Sep 15, 2005 4:52 pm
by xyligosw
Thanks,

I tried the @ to no avail, i looked up on php.net, and its mssql_error thats used i used mssql_get_last_message. And that seemed to work, it gave me an understandable error message!

Its not solved but at least i can start to look in the right place.

Thanks again..

Dan