I checked my sql statement in phpadmin and get the results I expect but in my php I cant seem to figure out how to echo the substring from the sql statement
#blogDB is a mysqli instance and connected to the database
$result=$blogDB->query("SELECT id, title, date, SUBSTRING(content,1,200) FROM blog ORDER BY date LIMIT 10");
while($row=$result->fetch_object())
{
$template->content=<<<content
<h1>{$row->title} - {$row->date}</h1>
{$row->content}
content;
break;
}
Everything is echoing out fine except for $row->content which is blank in php
The name of the field now is
SUBSTRING(content,1,200), you should specify the name you want usingaslike thisashere could be omitted though, so the following will work as well: