Monday 25 August 2014

Marquee style in different manner with PHP and MySql

marquee tag is used for more purpose, like top news publishing with marquee scrolling and more frequently publishing news or some other all things are scroll in a particular area, for that here we are using the marquee tag.

STOP / START

Marquee start and stop is the one main function most of us searching this thing, how is it happens on mouse hover. see the code.
<marquee behavior="scroll" onmouseover="this.stop();" onmouseout="this.start();">
</
marquee>

onmouseover="this.stop();" for stop the marquee content on on mouse over, onmouseout="this.start();" for start the marquee tag content on mouse out.

MARQUEE DIRECTION 

Marquee direction is for make the marquee move direction, the moving of marquee tag is move towards to which direction, like left to right, or right to left like that. for that we are using that marquee direction tag. see the code.
<marquee behavior="scroll" direction="right/left/up/down" onmouseover="this.stop();" onmouseout="this.start();">
</marquee>

choose any one direction in the above direction like left or right or up or down any one direction.

MARQUEE SPEED

Marquee  speed how reduce and increase the speed of marquee tag moving. see the code.
<marquee behavior="scroll" scrollamount="5" direction="right" onmouseover="this.stop();" onmouseout="this.start();">
</marquee>

that is scrollamount="5" we can give any number value for that, when you increase the value of scrollamount the speed will be increased, when you are reducing the scrollamount the speed will be decreased.

PHP and Mysql FETCH FROM DATABASE

<?php
$con=mysql_connect('localhost','root','');
$db=mysql_select_db('2my4edge',$con);
?>

Database name --> 2my4edge
table name --> marquee
column names --> id, feeds

<div class="main">
<?php
$fetch=mysql_query("select * from marquee limit 5");
if(mysql_num_rows($fetch))
{
?>
<marquee behavior="scroll" scrollamount="2" direction="up" onmouseover="this.stop();" onmouseout="this.start();">
<ul class="ulclass" >
<?php
while($row=mysql_fetch_array($fetch))
{
$id=$row['id'];
$feed=$row['feeds'];
?>
<li class="liclass">
<?php echo $feed; ?>
<?php } ?>
</li>
<?php } ?>
</ul>

</marquee>
</div>
you can clear with the above coding, just fetch data from the database, which is from marquee table, * astrick is for select all the field from the table name. and make the coding with simple.

No comments:

Post a Comment