Announcement

Collapse
No announcement yet.

Number of rows in table

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Number of rows in table

    I used this in one other app:
    [nova_stevilka] = mysql_num_rows(mysql_query("SELECT * FROM KD_nivo1 WHERE group_id = [group_id]"));


    Now I just copy/pase, but it doesn't work anymore.

    Do you have any good solution for getting number of rows in certain table?

    Thanks!

  • #2
    PHP 7? Mysql* is deprecated and deleted on PHP 7, use mysqli* instead
    /Giuseppe

    Professional Scriptcase Services
    Some Customers opinions

    Comment


    • #3
      Originally posted by mitja View Post
      I used this in one other app:
      [nova_stevilka] = mysql_num_rows(mysql_query("SELECT * FROM KD_nivo1 WHERE group_id = [group_id]"));
      Hello,
      I think that you are complicating yourself , why do not use count() function?

      PHP Code:
      sc_lookup(rs"SELECT count(*) FROM KD_nivo1 WHERE group_id = [group_id]");
      [
      nova_stevilka] = {rs[0][0]}; 
      Last edited by manfred; 05-02-2016, 04:17 PM.

      Comment


      • #4
        Originally posted by Giu View Post
        PHP 7? Mysql* is deprecated and deleted on PHP 7, use mysqli* instead
        Yes, I know that. I just thought that SC still support it. For others - for the reference - read "Warning" section: http://php.net/manual/en/function.mysql-num-rows.php
        Giu, thank you for that notice!


        Originally posted by manfred View Post

        Hello,
        I think that you are complicating yourself , why do not use count() function?
        manfred - you are right - thanks!

        Comment

        Working...
        X