donsafar
Posts: 90
|
Posted: 05/07/2004, 11:07 AM |
|
I am in process of converting database from access to sql server. I need some help in converting code that works on access but sql server. The original code is as follows:
$sal = array();
$db->query("select * from tblSales where SalesKey=$saleskey");
if ($db->next_record())
{
for ($i=0; $i<$db->num_fields(); $i++)
$sal[odbc_field_name($db->Query_ID, $i + 1)] = $db->f($i);
}
This code gives me an array with fieldname and associated data. I changed the code to following to work with sql server.
$sal = array();
$result = mssql_query("select * from tblSales where SalesKey=$saleskey");
$sal = mssql_fetch_assoc($result);
This works. I was wondering if there is a way to make this work with the $db control. I have tried the following, but it does not work.
$db->query("select * from tblSales where salesKey=$saleskey");
if ($db->next_record())
$sal = mssql_fetch_assoc($db->Query_ID);
_________________
Don Safar
|
|
|
|