townclown Posted August 28, 2008 Share Posted August 28, 2008 info:Windows, Apache, PHP5, SQL Server 2005 Hi, What is the quickest way to access a single value when querying a database. $getMsgID = mssql_query("SELECT TOP (1) msgID FROM dbo.messages")or die("Couldn't access table"); Is there a quicker way to access that single value then doing something like: $row = mssql_fetch_array($getMsgID); $latestMsgID = $row['msgID']; Link to comment https://forums.phpfreaks.com/topic/121749-easiest-way-to-get-a-single-value-from-a-database-table/ Share on other sites More sharing options...
BlueSkyIS Posted August 28, 2008 Share Posted August 28, 2008 no. i mean, you've got to 1. perform the query, 2. get a result set, 3. reference element(s) of the result set. not much room for trimming. Link to comment https://forums.phpfreaks.com/topic/121749-easiest-way-to-get-a-single-value-from-a-database-table/#findComment-628071 Share on other sites More sharing options...
townclown Posted August 28, 2008 Author Share Posted August 28, 2008 Thanks Link to comment https://forums.phpfreaks.com/topic/121749-easiest-way-to-get-a-single-value-from-a-database-table/#findComment-628075 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.