Jump to content

Archived

This topic is now archived and is closed to further replies.

ChambeRFienD

ODBC Access alternative to mysql_num_rows

Recommended Posts

I'm currently converting a script from using MySQL to Access. The only part I'm having trouble with is getting a mysql_num_row alternative for Access... Anyone have any ideas?

Share this post


Link to post
Share on other sites
[quote author=johndcastro link=topic=105499.msg421477#msg421477 date=1156439009]
Are you tring to loop through using while?

If you you can use

while (odbc_fetch_row($cur) {
[/quote]

I just need to count the number of entries in a database that match a query..

Example:

[code]$query = odbc_exec($odbc, "SELECT * FROM user_info WHERE cc='$search'") or die("MySQL Database Error: " . odbc_errormsg());

$count = counting_funtion($query);

if($count >= ......[/code]

Share this post


Link to post
Share on other sites
I think that you want [url=http://us3.php.net/manual/en/function.odbc-num-rows.php]odbc_num_rows[/url].


Hope this helps,
Tom

Share this post


Link to post
Share on other sites
[quote author=tomfmason link=topic=105499.msg421534#msg421534 date=1156445714]
I think that you want [url=http://us3.php.net/manual/en/function.odbc-num-rows.php]odbc_num_rows[/url].


Hope this helps,
Tom
[/quote]

Doesn't work with Access drivers. Returns with -1

Share this post


Link to post
Share on other sites
Ok try this.
[code=php:0]
$query = odbc_exec($odbc, "SELECT * FROM user_info WHERE cc='$search'") or die("MySQL Database Error: " . odbc

while ($row = odbc_fetch_array($query)) {
    $count = count($row);
}
if ($count == 1) {
  //do something
}
[/code]

Hope that one works.
Tom

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.