You are here: PHP and MS Access Record Count « PHP Programming Language « IT news, forums, messages
PHP and MS Access Record Count

Posted by thomasp on 11/15/16 11:26

I am trying to get a record count of a PHP query on a MS Acess database
using ODBC with a DSN for MS ACCESS connection. I got this code from the
PHP manual user notes. It seems to return the correct recount if the count
is greater than 0. It the count is 0 it returns the value of the $transid
variable in the code. Can someone tell me what I am doing wrong? I need
something that returns 0 if not records are found and an accurate count if
records are found. This seems like overkill to get a simple record count.
Thanks,
Thomas

function recordcount($conn,$transid) {
$sql = "SELECT COUNT(*) FROM tblTransaction WHERE TransID = '$transid'";
$query = odbc_prepare($conn,$sql) or die("ERROR");
odbc_execute($query) or die("ERROR");
$rc = odbc_fetch_into($query, $mycount);
$count = $mycount[0];
return $count;
}

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация