Hello i want to create a countdown with numbers
for example

  1. (some data from database)
  2. (some data from database)
  3. (some data from database)
  4. (some data from database)
  5. (some data from database)
    and so on....

I have done the ORDER BY and retreive the data i want from the database. but i dont know how to put the numbers countdown. Any idea? or link?

Recommended Answers

All 13 Replies

Show your code, you just have to add a variable to your output loop.

    foreach (....)
    {
    echo '
    <table>
        <tr>
            <td>
                <a href="'localhost/project/'.$id.'" >
                    <img src="'.$face.'" class="small_face" original-title="'.$chart_message.'" >
                </a>
            </td>
            <td>
                <a  href="'localhost/project/'.$id.'" >'.$title.'</a>'.$views.'
            </td>
        </tr>
    </table>';
    }

i want the numbers to be images
for example

1 as image
2 as another image
3 as other image
and so on

Please show a more complete code, based on the code provided, we cant even know where your variables getting data from. What I can see from your code, there is problem with <a href="'localhost/project/'.$id.'" >

sorry my laptop broke down. Cant do anything. Anyway there's nothing wrong with code. It works i just want to add an image of each number(1,2,3,4 etc) at the left of each <img src="'.$face.'" class="small_face" original-title="'.$chart_message.'" >

Then just add another <img src="/path/$idx.png" /> or whatever. Define $idx before the foreach and increment before the end of the loop.

i want the image to change. I dont want to use the same image.

That's what the variable is for.

just fixed my laptop. Can you link me an example pritaeas? thanks

Show a more complete code sample, the one above isn't complete enough.

$chartarray=$Wall->Chart_Audio();
if($chartarray)
{
    foreach ($chartarray as $datachart)
    {
    $chart_message= $datachart['message'];
    $chart_description = $datacharta['description'];
    $chart_type = $datachart['type'];
    $chart_uploads=$datachart['uploads'];
    $chart_msg_id = $datachart['msg_id'];
    $chart_views = $datachart['views_count'];
    $chart_venue = $datachart['venue'];
    $chart_dategig = $datachart['dategig'];
    $s = explode(",", $media_uploads);
    $p= $s[0];
    $r = $s[1];

    **$img = $base_url.'icons/number-1.png';**


    }
    echo '
    <table>
    <tr>
    <td rowspan="2">
    **<img src="'.$img.'"  class="small_face" />**
    </td>
    <td rowspan="2">
    <a href="'.$base_url.'roves/'.$chart_msg_id.'" >
    <img src="'.$rove_face.'" class="small_face" >
    </a>
    </td>
    <td>
    '.$chart_message.'
    </td>
    </tr>
    <td>
    <label>'.$chart_views.' views</label>
    </td>
    </tr>
    </table><br>';
    }
}
?>
$count = 1;
foreach ($chartarray as $datachart)
{
    $chart_message= $datachart['message'];
    $chart_description = $datacharta['description'];
    $chart_type = $datachart['type'];
    $chart_uploads=$datachart['uploads'];
    $chart_msg_id = $datachart['msg_id'];
    $chart_views = $datachart['views_count'];
    $chart_venue = $datachart['venue'];
    $chart_dategig = $datachart['dategig'];
    $s = explode(",", $media_uploads);
    $p= $s[0];
    $r = $s[1];

    $img = $base_url . "icons/number-$count.png";
    $count++;
}

oh man that was simple as.... My mind didnt go that i could use the +1 to call the path for the image. Thanks a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.