MSSQL_FETCH_ROW?!?

admin

Administrator
Staff member
Hi!

I'm having great difficulties retrieving data from our databases. I get the connections just fine, but then things start to go very wrong.

First out I've tried the MSSQL_FETCH_OBJECT which only gives an error saying Call to undefined function...
So, the next choice was the MSSQL_FETCH_ROW, it works fine, but somewhere I'm missing the point in how to read the data from the array, below is the current code included. Any pointers would be appreciated...

/J

$ms = mssql_connect("aspserver","sa","xxxx");
$dbs = mssql_select_db("klaessons",$ms);
$qrs = mssql_query("SELECT * FROM ATERFORSALJARE",$ms);
$rows = mssql_num_rows($qrs);
$fields = mssql_num_fields($qrs);
echo "<table border=1>";
while($row = mssql_fetch_row($qrs)){
for($a=0;$a<$fields;++$a){
if($a==0){
echo "<tr>";
}
echo "<td>$row[$a]</td>";
if($a == $fields){
echo "</tr>";
}
}
}
echo "</table>";
 
Back
Top