Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    Posts
    1

    Unanswered: PHP 4.1.2 throws error if no records are returned [newbie]

    Hi ,
    I am a newbie on Postgresql-PHP(4.1.2). The problem that i face is that whenever i have a query which doesnt return a row, it throws an error "Unable to jump to row 0 on PostgreSQL " (which sounds logical,but why an error).
    The lame way by which i am working around the problem currently is to have a query which counts the number of records, and only if the counter is > 0 do I proceed with executeing the query again. This obviously has two rounds to the db. I believe that pg_query solves this problem, but its valid only for a greater version. Is there a way around this. I currently use pg_exec to execute the query.

    $temp_Var = pg_exec($this->thiscon, $sqlstr)

    Cheers,
    Megh

  2. #2
    Join Date
    Oct 2003
    Location
    Slovakia
    Posts
    482

    Re: PHP 4.1.2 throws error if no records are returned [newbie]

    Originally posted by x_ors_jist
    Hi ,
    I am a newbie on Postgresql-PHP(4.1.2). The problem that i face is that whenever i have a query which doesnt return a row, it throws an error "Unable to jump to row 0 on PostgreSQL " (which sounds logical,but why an error).
    The lame way by which i am working around the problem currently is to have a query which counts the number of records, and only if the counter is > 0 do I proceed with executeing the query again. This obviously has two rounds to the db. I believe that pg_query solves this problem, but its valid only for a greater version. Is there a way around this. I currently use pg_exec to execute the query.

    $temp_Var = pg_exec($this->thiscon, $sqlstr)

    Cheers,
    Megh
    @$temp_Var = pg_exec($this->thiscon, $sqlstr);

    if(!$temp_Var){
    // do something
    } else {
    // show result of query
    }

    btw, 4.1.2 is very old version with many bugs, try to upgrade to newer version of PHP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •