SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Location
    KSA
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What is best the method for calculation in Tables?

    For the Best Executing

    Use this to number the row in Table ( calculation is the Comments ):

    PHP Code:
    $query "SELECT ....
     
    $result = mysql_query($query$conn);
     
    $count = mysql_num_rows($result); 
    -----------------------------------------
    or use This :

    PHP Code:
    //Create Column New ( Count )
     
    $query "INSERT ...
     
    $result = mysql_query($query$conn);
     
    if(
    $result) {
    $query = "SELECT ....
     
    $result mysql_query($query$conn);
     
    $record mysql_fetch_array($result)
    $record['Count'] ++;
     
    $query "Update ...
    $result = mysql_query($query$conn);
     
    //In subtraction Same 

  2. #2
    PHP manual bot bronze trophy Gaheris's Avatar
    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,195
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To get the number of rows you should use:
    Code:
    SELECT COUNT(*) FROM table

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Location
    KSA
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In Executing be Best !

  4. #4
    SitePoint Zealot jadmadi's Avatar
    Join Date
    Sep 2003
    Location
    Jordan
    Posts
    154
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe Shorter is better


Bookmarks

Posting Permissions

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