Hi,
I am trying to write a php and javascript that will pick up data from a
table and display and scroll it. I seem to have run out of ideas how to
make the script work. I don't get any display on the screen.
I use rand() limit 1 so only one row is selected.
Can some one tell me where I went wrong?
Adrian
=================cscroll.php ===============
<?
define("CS_FORM", 0);
define("A-city", 0);
define("A-curr1", 1);
define("A-catalogo", 2);
define("A-hf", 3);
define("A-curr2", 4);
define("A-vitofferta", 5);
define("A-fh", 6);
class cscroll
{
var $data;
var $tcity;
var $tcurr1;
var $tcatalogo;
var $thf;
var $tcurr2;
var $tvitofferta;
var $tfh;
function cscroll($data)
{
/*
**copy parameters into properties
*/
$this->data = $data;
foreach($data as $row)
{
//create list of unique choices for first selector
$this->tcity[($row[A-City])] = $row[A-City];
$this->tcurr1[($row[A-curr1])] = $row[A-curr1];
$this->tcatalogo[($row[A-catalogo])] = $row[A-catalogo];
$this->thf[($row[A-hf])] = $row[A-hf];
$this->tcurr2[($row[A-curr2])] = $row[A-curr2];
$this->tvitofferta[($row[A-vitofferta])] =
$row[A-vitofferta];
$this->tfh[($row[A-fh])] = $row[A-fh];
}
}
}
function initialize()
{
echo ("<form>");
echo("<input name=message size=57
value=\"$this->data[A-city]\">"); echo("</form>");
}
============ scroll.php ====================
while($row = mysql_fetch_object($result))
{
$tarray[] = array(
A-city=>$row->city,
A-curr1=>$row->curr1,
A-catalogo=>$row->catalogo,
A-hf=>$row->hf,
A-curr2=>$row->curr2,
A-vitofferta=>$row->vitofferta,
A-fh=>$row->fh,
);
}
//instantiate class
$tscroll = new cscroll(
$tarray);
?>
<html>
<head>
<script language="JavaScript">
<!-- // Text box marquee Modified by Prasad Mapatuna
// CHANGE THESE TO ALTER THE SCROLL SPEED
var timerID=null
var run=false
count = 10 // counter of cycles
ScrollSpeed = 300; // milliseconds between scrolls
ScrollChars = 1; // chars scrolled per time period
function Stop()
{
if(run) clearRimeout(timerID)
run=false
}
function Start()
{
Stop();
Marquee()
}
function Marquee()
{
var msg = document.forms[0].message.value;
var tmp = msg.substring(0,ScrollChars);
msg = msg.substring(ScrollChars) + tmp;
document.forms[0].message.value = msg;
if(count<200)
{
timerID = setTimeout('Marquee()',ScrollSpeed);
run= true;
count++;
}
}
<!-- end -->
</script>
<title></title>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
</head>
<body bgcolor=white>
<script type="text/javascript" language="JavaScript">
<?php
initialize();
?>
<?php
include("footer.php");
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]