Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23
  1. #11
    Join Date
    Jun 2007
    Location
    England
    Posts
    495
    Tokens
    0

    Default

    From what i have seen the script works so what are you arguing about :S


  2. #12
    Join Date
    Sep 2006
    Location
    Hobart, Australia
    Posts
    593
    Tokens
    0

    Default

    Quote Originally Posted by Luno1599 View Post
    From what i have seen the script works so what are you arguing about :S
    Well, it's slightly off-topic, but if we have a disagreement with a coder's methods, we normally let them know after they've posted it.

  3. #13
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by benzoenator View Post
    Well, it's a waste of server resources, time, and most importantly, waste the energy your fingers have to go to typing it in

    PHP Code:
    if(mysql_num_rows($query) > 0) {

         
    // Rows were returned

    }

    else {

         
    // No rows returned (0)


    That's all you need to do to check for rows returned
    I have worked with PHP probably years more then you have.
    I think I know how to code.

    Plus why add the num_rows into the if statement, thats a waste of typing plus server resources if you are expecting to use the num rows again

    So please don't tell me how to code, when I know how to

  4. #14
    Join Date
    Jun 2007
    Location
    England
    Posts
    495
    Tokens
    0

    Default

    Oh yeah XD i get confused easy


  5. #15
    Join Date
    Sep 2006
    Location
    Hobart, Australia
    Posts
    593
    Tokens
    0

    Default

    Quote Originally Posted by Dentafrice, View Post
    I have worked with PHP probably years more then you have.
    I think I know how to code.

    Plus why add the num_rows into the if statement, thats a waste of typing plus server resources if you are expecting to use the num rows again

    So please don't tell me how to code, when I know how to
    I'm not saying you don't know how to code, I'm just letting you know that it's a waste of time checking for empty strings, when mysql_num_rows will never return an empty string.

    The code was used as an example. Of course, if you were expecting to use the data again, you would store it in a variable. However, even if I was modelling the code off Waterfall's question, from the looks of things, he wouldn't need to use it again (why would he need to check for multiple IP entries in a script twice)? I suggest you stop the "I've been coding for years more than you" ploy. The length of time someone has been practising at something is a bad portrayal of skill, as seen here.

  6. #16
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    No actually it isn't.

    If you have no DB connection, and you do mysql_num_rows and error reporting is off, you would receive an empty string

    Also if you do num_rows without an actual query, and without any error reporting it returns an empty string.

  7. #17
    Join Date
    Jun 2007
    Location
    England
    Posts
    495
    Tokens
    0

    Default

    That is true.. because it dose not exist


  8. #18
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    I think thats the reason I started doing it that way to begin with.

  9. #19
    Join Date
    Sep 2006
    Location
    Hobart, Australia
    Posts
    593
    Tokens
    0

    Default

    Quote Originally Posted by Dentafrice, View Post
    No actually it isn't.

    If you have no DB connection, and you do mysql_num_rows and error reporting is off, you would receive an empty string

    Also if you do num_rows without an actual query, and without any error reporting it returns an empty string.
    ... That's one of the most ridiculous arguments I've heard. If there wasn't a database connection in the first place, you'd have a lot more to worry about than what mysql_num_rows was returning. In addition, the entire script would be rendered useless, because it would be unable to perform queries needed to function properly.

    I would bet a large sum of money that software developers like Jelsoft, Invision and the like don't test for empty strings, when validating mysql_num_rows results, for the reason that it is so petty. If they don't, then there surely is no point.

  10. #20
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    Look, it doesn't matter.. I use it, you don't.. it doesn't change a thing. I will still use it, you don't have to.

Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

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