1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to echo from database

Discussion in 'PHP' started by tasos55, Apr 8, 2013.

  1. #1
    Hello,

    here below is the script that i use, but i have to echo all out like this below.

    Funny: 1000
    Cars: 500
    Bikes: 10000
    Crazy: 5.000.000 :)

    This script works, is there a way to short this script and to echo out like above and to continue so on ?
    Thanks.
    here is the script.
    <?php
    include 'connect.php';
     
    $result = mysql_query("select count(1) FROM videos WHERE title LIKE '%Funny%'");
    $row = mysql_fetch_array($result);
     
    $total = $row[0];
    echo "</br>Funny: " . $total;
     
    $result = mysql_query("select count(1) FROM videos WHERE title LIKE '%Cars%'");
    $row = mysql_fetch_array($result);
     
    $total = $row[0];
    echo "</br>Cars: " . $total;
     
    $result = mysql_query("select count(1) FROM videos WHERE title LIKE '%Bikes%'");
    $row = mysql_fetch_array($result);
     
    $total = $row[0];
    echo "</br>Bikes: " . $total;
     
    $result = mysql_query("select count(1) FROM videos WHERE title LIKE '%Crazy%'");
    $row = mysql_fetch_array($result);
     
    $total = $row[0];
    echo "</br>Crazy: " . $total;
     
    mysql_close($connect);
    ?>
    PHP:


     
    tasos55, Apr 8, 2013 IP
  2. tasos55

    tasos55 Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #2
    oh by the way that smiley is not needed... hahaha
     
    tasos55, Apr 8, 2013 IP