Get last record using php or php with mysql


ashwin vasava

For example: In this example explode commas and make a linkable every word.

<?php
$ash = ‘1,2,3,4’;
$ashval = explode(‘,’,$ash);

foreach($ashval as $val)
{
print “<a href=”>”.$val.”</a>”;
if($val!=end($ashval))
{
print ‘,’;
}
else
{
print ”;
}

}
?>

OR you can use another method:

<?php
$ash = ‘1,2,3,4’;
$ashval = explode(‘,’,$ash);
$checkval=count($ashval);

foreach($ashval as $val)
{

if($checkval!=$val)
{
$te=”,”;
}
else
{
$te=””;
}
print “<a href=”>”. $val.”</a>”.$te;

}
?>

View original post

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s