SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Syntax question

  1. #1
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Syntax question

    if i'm going to get the sum of a bunch of rows, would my query and the php code look like this?
    PHP Code:
        <?
        $all_link_query 
    "SELECT sum(counter) from links";
        
    $do_sum_query mysql_query($all_link_query$db_connect);
        
    $result mysql_fetch_array($do_sum_query);
        
    ?>
         <tr>
          <td width="100%">
          <font size="2" face="verdana">There are currently <b><?=$result[counter]; ?></b> links available.
    Last edited by Defender1; Oct 5, 2001 at 05:55.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  2. #2
    epsilon transition cupid's Avatar
    Join Date
    Aug 2001
    Location
    Kent, Ohio
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:

    PHP Code:
    <?php
        $all_link_query 
    "SELECT sum(counter) as blah from links";

        
    $do_sum_query mysql_query($all_link_query$db_connect);
        
    $result mysql_fetch_array($do_sum_query);
    ?>
         <tr>
          <td width="100%">
          <font size="2" face="verdana">There are currently <b><?=$result[blah]; ?></b> links available.

  3. #3
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cool, thx.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*


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
  •