CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.

YesSoftware Forums -> Archive -> GotoCode Archive


Print topic Send  topic

Author Message
Peter K
Posted: 12/19/2003, 8:02 PM

Has anyone been able to create a marquee from rows within a database? I'm not able to figure this out. Using PHP and MySQL.
Posted: 12/20/2003, 8:22 AM

Yes, what you have to do is get the data from the databse and put it in the marquee script. I can her you say duh... at this moment :-)

First create the query that get's the info from the database.
In the script replace the pieces of code containing the info that is going to be displayed and replace them with {my_info}

Now do a set tag action that walks through the resultset (array) of the query and writes each entry to the html page. Ok I'll post both the html bits of a paige containing a scroll script and the event code for you so this is going to look terrible but might be of use


<style type="text/css">#dropcontentsubject{ width: 100%; font-weight: bold; }
.dropcontent{ width: 100%; height: 150px; border: 1px solid black;
background-color: #DFDFFF; padding: 3px; display:block; }</style>
<script type="text/javascript">

* ProHTML Ticker script- Dynamic Drive (
* This notice must stay intact for use
* Visit for full source code

var tickspeed=10000 //ticker speed in miliseconds (2000=2 seconds)
var enablesubject=1 //enable scroller subject? Set to 0 to hide

if (document.getElementById){
document.write('<style type="text/css">\n')

var selectedDiv=0
var totalDivs=0

function contractall(){
var inc=0
while (document.getElementById("dropmsg"+inc)){

function expandone(){
var selectedDivObj=document.getElementById("dropmsg"+selectedDiv)
selectedDiv=(selectedDiv<totalDivs-1)? selectedDiv+1 : 0

function startscroller(){
while (document.getElementById("dropmsg"+totalDivs)!=null)
if (!enablesubject)

if (window.addEventListener)
window.addEventListener("load", startscroller, false)
else if (window.attachEvent)
window.attachEvent("onload", startscroller)

<body bottommargin="0" leftmargin="0" topmargin="0" rightmargin="0" marginwidth="0" marginheight="0">
<p><font face="Tahoma">{header}</font></p>
<table cellspacing="2" cellpadding="1" width="100%" border="0">
<tr align="left" valign="top">
<td width="20%"><font size="2">
<p><font face="Tahoma" size="2"></font> </p>
</font></font> </td>
<td width="50%"><font size="2">
<p><font face="Tahoma">
<!-- BEGIN Grid news --></font>
<!-- BEGIN Row -->
<td><font face="Tahoma" size="2"><strong>{news_title}</strong> </font></td>
<td width="20%">
<p align="right"><strong><font face="Tahoma" size="2">{news_date}</font></strong></p>

<td colspan="2"><font face="Tahoma" size="2">{news_html} </font></td>

<td colspan="2"><font face="Tahoma" size="2">{news_by} </font></td>

<td colspan="2"><font face="Tahoma" size="2">
<!-- END Row -->
<!-- BEGIN NoRecords -->
<td colspan="2"><font face="Tahoma" size="2">No records </font> </td>
<!-- END NoRecords -->
<td colspan="2"><font face="Tahoma" size="2">
<!-- BEGIN Navigator Navigator --> 
<!-- BEGIN Pages -->
<!-- BEGIN Page_On --><a href="{Page_URL}">{Page_Number}</a> <!-- END Page_On -->
<!-- BEGIN Page_Off -->{Page_Number} <!-- END Page_Off --><!-- END Pages -->van
{Total_Pages} <!-- END Navigator Navigator --></font>  </font> </td>

<font face="Tahoma"><!-- END Grid news --></font></p>
<td width="20%">
<table width="100%" border="0">
<font face="Tahoma" size="2"><div id="dropcontentsubject">
<!-- BEGIN myblock -->{my_block}
<!-- END myblock--></font> </td>

</font> </p>

global $Tpl;
$db=new clsDBConnection1;
$db->query("select news_title,news_html from news where news_cat=7 and news_cluster=8 order by news_date desc");
$Tpl->SetVar("my_block", "<font face='Tahoma' size='2'><div id='dropmsg" .$num ."' class='dropcontent' subject='" .$my_array["subject"] ."'>" .$my_array["content"] ."</div></font>");

In the html stuff look at the myblock stuff. Hope this helps

Peter K
Posted: 12/20/2003, 11:18 AM

Wow, more code than I would have thought. I will give it try. Thanks for the detail and time it took to write this.


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

Home   |    Search   |    Members   |    Register   |    Login

Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by  and YesSoftware, Inc.