Jump to content

getting mssql table information to excel


udaykanth

Recommended Posts

Am new bie to php mssql as well

Am trying to get a mssql table information to excel.

I have following coding.....

<?php

$myServer = "N3085";

$myUser = "sa";

$myPass = "sa";

$myDB = "examples";

 

//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 * from oms";

 

 

//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["id"] . $row["name"] . $row["year"] . "</li>";

}

//close the connection

mssql_close($dbhandle);

?>

 

And i have been running dis php coding in wamp server

Am getting a error a undefined function mssql_connect() at line 15.

 

 

Thx in Advance

Link to comment
Share on other sites

WAMP server must not have MSSQL support by default. This post appears to offer a solution (scroll to the last post), but there's no reply after so can't say if it works or not. Should be able to find something else on Google if not though.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.