$text = join("\n", array_map("trim", explode("\n", $text)));
PHP easiest color swap for rows
<style>
.odd{background-color:red;}
</style>
$c = true;
foreach($posts as $post)
echo '<div'.(($c = !$c)?' class="odd"':'').">$post</div>";
Source: https://stackoverflow.com/questions/399137/easiest-way-to-alternate-row-colors-in-php-html
Make CSS behave like a HTML table
#container {
display: table;
}
#row {
display: table-row;
}
#left, #right, #middle {
display: table-cell;
}
<div id="container">
<div id="row">
<div id="left">
<h4>Left Col</h4>
<p>...</p>
</div>
<div id="middle">
<h4>Middle Col</h4>
<p>...</p>
</div>
<div id="right">
<h4>Right Col</h4>
<p>...</p>
</div>
</div>
</div>
Source: https://snook.ca/archives/html_and_css/getting_your_di/
mySQL converting lat/lon to spatial
INSERT INTO myTable (coordinates)
SELECT GeomFromText(CONCAT('POINT(',ot.latitude, ' ', ot.longitude,')'))
FROM otherTable ot;
or
UPDATE myTable
SET coordinates = GeomFromText(CONCAT('POINT(',latitude, ' ', longitude,')'));
MySQL determine max number of character in a field
SELECT MAX((column1)) maxCol1,
MAX(CHAR_LENGTH(column2)) maxCol2
FROM tableName