Jump to content


Photo

ODBC Access alternative to mysql_num_rows


  • Please log in to reply
5 replies to this topic

#1 ChambeRFienD

ChambeRFienD
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 24 August 2006 - 04:53 PM

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?

#2 johndcastro

johndcastro
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 24 August 2006 - 05:03 PM

Are you tring to loop through using while?

If you you can use

while (odbc_fetch_row($cur) {

#3 ChambeRFienD

ChambeRFienD
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 24 August 2006 - 05:07 PM

Are you tring to loop through using while?

If you you can use

while (odbc_fetch_row($cur) {


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

Example:

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

$count = counting_funtion($query);

if($count >= ......


#4 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 24 August 2006 - 06:55 PM

I think that you want odbc_num_rows.


Hope this helps,
Tom

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#5 ChambeRFienD

ChambeRFienD
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 24 August 2006 - 07:17 PM

I think that you want odbc_num_rows.


Hope this helps,
Tom


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

#6 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 24 August 2006 - 07:41 PM

Ok try this.
$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
}

Hope that one works.
Tom


Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users