Hey guys (and gals),
I am having a good time with this one…
I cannot get it to return only the first 15 characters of the title. What am I doing wrong?
This is pretty much my first time coding PHP and MySQL, so it may be a input error but what seems to be the deal?
<?
require_once('inc/mysqlconnect.inc');
@mysql_select_db("database");
//$sql = 'SELECT title FROM blog_entry ORDER BY date DESC LIMIT 0, 8';
//$sql = 'SELECT *, LEFT(title, 14) FROM blog_entry ORDER BY date DESC LIMIT 0, 8';
$sql = 'SELECT title, SUBSTRING(title, 15) FROM blog_entry ORDER BY date DESC LIMIT 0, 8';
//$sql = 'SELECT substring(title, 1, round(char_length(title) * 0.70) ) FROM `blog_entry` ORDER BY entryNo DESC LIMIT 0, 10';
$result = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($result)!= 0)
{
while($row = mysql_fetch_array($result))
{
echo "<b>+</b> <a href=\"link.php\">$row[6]</a><br />";
}
echo "</p>";
}
?>
As you can see thers several ways I tried doing it…but it’s not working
Thanks for any help!
Joel