lonewolf217 Posted June 27, 2008 Share Posted June 27, 2008 I pull rows from the database using $row = mssql_fetch_row($sql) where $sql is returned from mssql_query I am trying to figure out why I can use echo $row[1]; but whenever i try to use echo $row['column_name']; I get errors like "Notice: Undefined index: column_name on row xx" I have seen the second example used many times in sample code so I am trying to figure out what I am doing wrong since it is so much easier to keep track of what I am echoing where. Quote Link to comment https://forums.phpfreaks.com/topic/112223-solved-difference-between-row1-and-rowcolumn_name/ Share on other sites More sharing options...
Tchelo Posted June 27, 2008 Share Posted June 27, 2008 If you would like to use the field name as key in your array, you should use mssql_fetch_array($sql); There is an optional parameter, which you could use to return the array with numbered keys, named keys or both (default). Check http://www.php.net/mssql_fetch_array. Quote Link to comment https://forums.phpfreaks.com/topic/112223-solved-difference-between-row1-and-rowcolumn_name/#findComment-576101 Share on other sites More sharing options...
lonewolf217 Posted June 27, 2008 Author Share Posted June 27, 2008 perfect thanks! Quote Link to comment https://forums.phpfreaks.com/topic/112223-solved-difference-between-row1-and-rowcolumn_name/#findComment-576106 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.