TinyPortal

Development => Block Codes => Topic started by: Mitch on March 15, 2006, 08:49:55 PM

Title: Today In History Question
Post by: Mitch on March 15, 2006, 08:49:55 PM
What my original code is:

$my_height = 15;
$today = mktime();
$today_day = date("j", $today);
$today_month = date("n", $today);

$request = db_query("SELECT pn_yid, pn_content FROM nuke_ephem WHERE pn_did=$today_day AND pn_mid=$today_month ORDER BY pn_yid ASC", __FILE__, __LINE__);
if (mysql_num_rows($request) > 0)
{
echo '<div style="height: '.$my_height.'ex; overflow: auto;">';
while($row = mysql_fetch_assoc($request)){
echo '<b>' . $row['pn_yid'] . '</b> - ' . $row['pn_content'] . '<br />';
}
                echo '</div>';
mysql_free_result($request);
  }


I would like it to scroll and then stop with mouse hovers over it I thought that code would be this:

$my_height = 15;
$today = mktime();
$today_day = date("j", $today);
$today_month = date("n", $today);

$request = db_query("SELECT pn_yid, pn_content FROM nuke_ephem WHERE pn_did=$today_day AND pn_mid=$today_month ORDER BY pn_yid ASC", __FILE__, __LINE__);
if (mysql_num_rows($request) > 0)
{

echo '<marquee bgcolor="transparent" scrollamount="2" direction="up" loop="true" width="100%" onmouseover='this.stop()'onmouseout='this.start()'">;

echo '<div style="height: '.$my_height.'ex; overflow: auto;">';
while($row = mysql_fetch_assoc($request)){
echo '<b>' . $row['pn_yid'] . '</b> - ' . $row['pn_content'] . '<br />';
}
                echo '</div>';
echo '</marquee>;
mysql_free_result($request);
  }


But its not. I get this error when I try to do it:

QuoteParse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/gamesnet/public_html/forums/Sources/Load.php(1613) : eval()'d code(34) : eval()'d code on line 10
Title: Re: Today In History Question
Post by: IchBin on March 15, 2006, 10:12:54 PM
This line:
echo '</marquee>;

Needs to have this:
echo '</marquee>';
Title: Re: Today In History Question
Post by: TwinsX2Dad on March 15, 2006, 10:16:16 PM
Lose one apostrophe and your echo gets lopsided.

Nobody wants a lopsided echo.
Title: Re: Today In History Question
Post by: Mitch on March 16, 2006, 01:55:27 AM
Did what you told me to now I have a

Quote
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/gamesnet/public_html/forums/Sources/Load.php(1613) : eval()'d code(34) : eval()'d code on line 10
Title: Re: Today In History Question
Post by: IchBin on March 16, 2006, 06:09:29 AM
Also this line:
echo '<marquee bgcolor="transparent" scrollamount="2" direction="up" loop="true" width="100%" onmouseover='this.stop()'onmouseout='this.start()'">;


Needs to be this:  (I think)
echo '<marquee bgcolor="transparent" scrollamount="2" direction="up" loop="true" width="100%" onmouseover='this.stop()'onmouseout='this.start()'>';

Title: Re: Today In History Question
Post by: feline on March 16, 2006, 09:32:13 AM
the correct line:

echo '<marquee bgcolor="transparent" scrollamount="2" direction="up" loop="true" width="100%" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>';


Fel
Title: Re: Today In History Question
Post by: crip on March 16, 2006, 10:13:40 AM
If micth hasn't run the sql .zip via myphpadmin it will never work....
Title: Re: Today In History Question
Post by: Mitch on March 16, 2006, 12:36:25 PM
Hmm I can try to do this.

But just so everyone knows it was working before I decided to make it scroll.
Title: Re: Today In History Question
Post by: Mitch on March 16, 2006, 01:19:30 PM
Ok well I got this to work. But then I just deleted it because it made the block headers "bounce".
Title: Re: Today In History Question
Post by: IchBin on March 16, 2006, 02:14:16 PM
Quote from: feline on March 16, 2006, 09:32:13 AM
the correct line:

echo '<marquee bgcolor="transparent" scrollamount="2" direction="up" loop="true" width="100%" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>';


Thank you Fel, I haven't quite learned what needs to be escaped and why. In that example I finally understood it. :)

Fel
Title: Re: Today In History Question
Post by: Mitch on March 16, 2006, 02:31:55 PM
Oh and yes thank you Fel!!!!!
Title: Re: Today In History Question
Post by: elpvn on April 09, 2006, 07:50:11 PM
Hix, It scroll all of one: theÃ,  scroll bar and the content of blockÃ,  :o

Then I have made correct it by this code

$my_height = auto;
$today = mktime();
$today_day = date("j", $today);
$today_month = date("n", $today);

$request = db_query("SELECT pn_yid, pn_content FROM nuke_ephem WHERE pn_did=$today_day AND pn_mid=$today_month ORDER BY pn_yid ASC", __FILE__, __LINE__);
if (mysql_num_rows($request) > 0)

Ã,   {echo '<marquee bgcolor="transparent" scrollamount="2" direction="up" loop="true" width="100%" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>';

Ã,  Ã,  Ã, 
Ã,  Ã,  Ã,  Ã,  echo '<div style="height: '.$my_height.'ex; overflow: auto;">';
while($row = mysql_fetch_assoc($request)){
echo '<b>' . $row['pn_yid'] . '</b> - ' . $row['pn_content'] . '<br />';
}
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  echo '</div>';
Ã,  Ã,  Ã,  Ã,  echo '</marquee>';Ã,  Ã,  Ã,  Ã,  Ã, 
mysql_free_result($request);
Ã,  }


It has fixedÃ, and work fine :laugh: