Results 1 to 6 of 6
  1. #1
    Join Date
    May 2007
    Posts
    8

    Unanswered: Show Values on HTML

    I have a vbulletin forum. What I need is, that last value from table "userid" shows on a HTML page using "include php"

    Actually I want to show the number of users on the main page of my website, which in HTML format. But that should be in the form of "2,000" if the last value is 2000

    Is it possible?

    Right now I am using this PHP to extract the value and then using include tags in HTML page to fetch this file

    PHP Code:
    <?php
    $con 
    mysql_connect("localhost","username","pass");
    if (!
    $con)
      {
      die(
    'Could not connect: ' mysql_error());
      }

    mysql_select_db("database"$con);

    $result mysql_query("SELECT userid FROM user ORDER BY userid DESC LIMIT 0,1");

    echo 
    "<table border='0'>";
    echo 
    "<tr>";
    while(
    $row mysql_fetch_array($result))
      {
      echo 
    "<td style='color:#FF0000 '>" $row['userid'] . "</td>";
      } 
        {
      echo 
    "<td>Users Online & counting. Are you one of them?</td>";
      }
      {
      echo 
    "</tr>";
      }
    echo 
    "</table>";

    mysql_close($con);
    ?>

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    SELECT COUNT(*) AS number_of_users
    FROM user
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    Actually I want to show the number of users on the main page of my website, which in HTML format. But that should be in the form of "2,000" if the last value is 2000
    you could use the PHP function number_format to add the comma's.

    echo number_format( $num_users );

  4. #4
    Join Date
    May 2007
    Posts
    8
    How can I use that? I dont know PHP or MYSQL, so please explain me. The file I am using has been coded by someone else and I found it over internet. Please explain that to me.

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by THE DON
    I dont know PHP or MYSQL
    with all respect, if you don't know php or mysql, maybe you should get someone else to do this for you
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  6. #6
    Join Date
    May 2007
    Posts
    8
    OK, anyone here can do that? How much I have to pay?

Posting Permissions

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