hey people,
hope you all had a nice xmas.
I have an entry in a database under the field 'title' called:
'BOL blah'
and say another called:
'blah'
I have this code:
<?php
$result=mysql_query("SELECT * FROM $TableName ORDER BY date ASC LIMIT 1");
while ($row= mysql_fetch_array($result)) {
$BOL = substr($row['title'],0,3);
if ($BOL == 'BOL'){
if (!empty($row['filename'])){
echo '
<img src="'.$row['filename'].'" border="1"><br>';
}
echo substr($row['title'],3,200);
}
}
?>
How can I select from the table one row starting with the first row that has BOL for the first three letters of its title?
How can I write this as a proper query?
$result=mysql_query("SELECT * FROM $TableName where substr(title,0,3) == 'BOL' ORDER BY date ASC LIMIT 1");