Hey guys, So I've been reading all the related topics but they still haven't helped my solve my problem. I am new to php, so any help is greatly appreciated. I am trying to make an array of customers by using a select statement in php but can't connect to the database.
I get this error: Call to undefined function mssql_connect() in script on line 20. Any thoughts? Thanks again!
And the code:
$serverName = "*";
$uid = "*";
$pwd = "*";
$databaseName = "**";
$connectionInfo = array( "User"=>$uid,
"Password"=>$pwd,
"Database"=>$databaseName);
/* Connect using SQL Server Authentication. */
$conn = mssql_connect($serverName, $connectionInfo);
$tsql = "SELECT FirstName, LastName, EmailAddr FROM Customer";
/* Execute the query. */
$stmt = mssql_query($conn, $tsql);
if ($stmt)
{
while($row = mysql_fetch_array( $stmt, MSSQL_FETCH_ASSOC))
{
$FirstName = $row["FirstName"];
$LastName = $row["LastName"];
$EmailAddr = $row["EmailAddr"];
echo "$FirstName";
echo "$LastName";
echo "$EmailAddr";
}
}
else
{
echo "Submission unsuccessful.";
die(print_r( mssql_errors(), true));
}
/* Free statement and connection resources. */
mssql_free_stmt($stmt);
mssql_close($conn);
mYsql_connect()?