Is there any way to get just a part from MySql cell and ignore everything after predefined character? For example, I have row with cell's "ID, LINK, PHONE". Inside LINK cell DB wrights links like mysite.com/mypicture.jpeg. Is there any way, to get just "mysite.com" from this cell and ignore everything after slash, so I can echo it inside anchor tag?
Edit: To be absolutely clearly I'm posting the existing code:
<?PHP
if(mysql_connect($db_host,$db_user,$db_pass)) {
mysql_select_db($db_name);
mysql_query("CREATE TABLE IF NOT EXISTS smsads(id bigint unsigned primary key auto_increment, link varchar(255), fromnum varchar(60))");
$res = mysql_query("SELECT * FROM smsads ORDER BY id DESC LIMIT 3");
while($row = mysql_fetch_object($res)) {
$http_link = $row->link;
if(strstr($http_link, 'http') === FALSE) $http_link = 'http://'.$http_link;
echo "<div id=\"banner\"><a href=\"{$http_link}\" target=\"_blank\"><img src=\"{$http_link}\" /></a></div>";
}
}
?>