Jump to content

Adkar

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Adkar's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for the replies guys, @ Brian i downloaded the sqlsrv extension and installed it to C:\php\ext i dont have a php.ini file though. where could i get this file from? once i have modified the php.ini file with the extension mentioned in your link, and my code to sqlsrv instead of mssql would my code work? Thanks again
  2. Hi guys, I have a problem. been looking at forums all day but cant find the right one to help me out. I'm using Windows 7 and EW(Expression Web) 4 to create a php site, but have had trouble all day trying to get it to connect to a MSSQL database (SQL Server 2008 R2). I'm a complete noob with php so please bare with me Here is my code to connect to the database <? $myServer = ".\MSSQLHOSTING"; $myUser = "Username"; $myPass = "Password"; $myDB = "database"; //connection to the database $dbhandle = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer"); //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 UserName, UserPassword"; $query .= "FROM Administrator"; $query .= "WHERE UserName='Administrator'"; //execute the SQL query and return records $result = mssql_query($query); $numRows = mssql_num_rows($result); echo "<h1>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>"; //display the results while($row = mssql_fetch_array($result)) { echo "<li>" . $row["UserName"] . $row["UserPassword"]. "</li>"; } //close the connection mssql_close($dbhandle); ?> I get this error from this code: Fatal error: Call to undefined function mssql_connect() What files and code do i need for this to work? Any help is welcome but remember i'm new to php Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.