TinyPortal

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

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

Code: [Select]
$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:

Code: [Select]
$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:

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 15, 2006, 03:12:54 PM
This line:
Code: [Select]
echo '</marquee>;
Needs to have this:
Code: [Select]
echo '</marquee>';
Title: Re: Today In History Question
Post by: TwinsX2Dad on March 15, 2006, 03: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 15, 2006, 06:55:27 PM
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 15, 2006, 11:09:29 PM
Also this line:
Code: [Select]
echo '<marquee bgcolor="transparent" scrollamount="2" direction="up" loop="true" width="100%" onmouseover='this.stop()'onmouseout='this.start()'">;

Needs to be this:  (I think)
Code: [Select]
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, 02:32:13 AM
the correct line:
Code: [Select]
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, 03: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, 05:36:25 AM
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, 06:19:30 AM
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, 07:14:16 AM
the correct line:
Code: [Select]
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, 07:31:55 AM
Oh and yes thank you Fel!!!!!
Title: Re: Today In History Question
Post by: elpvn on April 09, 2006, 12: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

Code: [Select]
$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: