ksgush Posted January 25, 2007 Share Posted January 25, 2007 Hi... I never used MySQL database that much needless to say MSSQL so, bear with me.I have this code, and it's not working.. can anyone see anything wrong with it ??I am not getting any errors, my page is blank and my source view is empty with standard html tags.[code]<?php$myServer = "888.88.88.888";$myUser = "888888";$myPass = "8888888";$myDB = "888888";$dbhandle = mssql_connect($myServer, $myUser, $myPass) //select a database to work with$selected = mssql_select_db($myDB, $dbhandle) or die("Couldn't open database $myDB"); //declare the SQL statement that will query the database$query = "SELECT CartID FROM WSTOrders;";$selected = mssql_query($query);$numRows = mssql_num_rows($selected); echo "<h1>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>"; //display the results while($row = mssql_fetch_array($selected)){ echo $row["CartID"] . "";}?>[/code]Any and much help appreciated.. Quote Link to comment https://forums.phpfreaks.com/topic/35607-new-to-mssql-under-php-help/ Share on other sites More sharing options...
bezaleel Posted January 26, 2007 Share Posted January 26, 2007 This should do it<?php$myServer = "888.88.88.888";$myUser = "888888";$myPass = "8888888";$myDB = "888888";// [color=red]$dbhandle = mssql_connect($myServer, $myUser, $myPass) - This is where the error is. Missing semi-colon at end of line.[/color]$dbhandle = mssql_connect($myServer, $myUser, $myPass); //select a database to work with$selected = mssql_select_db("$myDB", $dbhandle) or die("Couldn't open database $myDB");//declare the SQL statement that will query the database$query = "SELECT CartID FROM WSTOrders;";$selected = mssql_query($query);$numRows = mssql_num_rows($selected);echo "<h1>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>";//display the resultswhile($row = mssql_fetch_array($selected)){ echo $row["CartID"] . "<br />";}?> Quote Link to comment https://forums.phpfreaks.com/topic/35607-new-to-mssql-under-php-help/#findComment-169569 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.